Piggyback Microcontroller
   HOME

TheInfoList



OR:

A microcontroller (MC, uC, or μC) or microcontroller unit (MCU) is a small
computer A computer is a machine that can be Computer programming, programmed to automatically Execution (computing), carry out sequences of arithmetic or logical operations (''computation''). Modern digital electronic computers can perform generic set ...
on a single
integrated circuit An integrated circuit (IC), also known as a microchip or simply chip, is a set of electronic circuits, consisting of various electronic components (such as transistors, resistors, and capacitors) and their interconnections. These components a ...
. A microcontroller contains one or more
CPUs A central processing unit (CPU), also called a central processor, main processor, or just processor, is the primary Processor (computing), processor in a given computer. Its electronic circuitry executes Instruction (computing), instructions ...
(
processor core A central processing unit (CPU), also called a central processor, main processor, or just processor, is the primary Processor (computing), processor in a given computer. Its electronic circuitry executes Instruction (computing), instructions ...
s) along with
memory Memory is the faculty of the mind by which data or information is encoded, stored, and retrieved when needed. It is the retention of information over time for the purpose of influencing future action. If past events could not be remembe ...
and programmable
input/output In computing, input/output (I/O, i/o, or informally io or IO) is the communication between an information processing system, such as a computer, and the outside world, such as another computer system, peripherals, or a human operator. Inputs a ...
peripherals. Program memory in the form of
NOR flash Flash memory is an electronic non-volatile computer memory storage medium that can be electrically erased and reprogrammed. The two main types of flash memory, NOR flash and NAND flash, are named for the NOR and NAND logic gates. Both use ...
, OTP ROM, or
ferroelectric RAM Ferroelectric RAM (FeRAM, F-RAM or FRAM) is a random-access memory similar in construction to DRAM but using a ferroelectric layer instead of a dielectric layer to achieve non-volatility. FeRAM is one of a growing number of alternative non-vol ...
is also often included on the chip, as well as a small amount of
RAM Ram, ram, or RAM most commonly refers to: * A male sheep * Random-access memory, computer memory * Ram Trucks, US, since 2009 ** List of vehicles named Dodge Ram, trucks and vans ** Ram Pickup, produced by Ram Trucks Ram, ram, or RAM may also ref ...
. Microcontrollers are designed for embedded applications, in contrast to the
microprocessor A microprocessor is a computer processor (computing), processor for which the data processing logic and control is included on a single integrated circuit (IC), or a small number of ICs. The microprocessor contains the arithmetic, logic, a ...
s used in
personal computer A personal computer, commonly referred to as PC or computer, is a computer designed for individual use. It is typically used for tasks such as Word processor, word processing, web browser, internet browsing, email, multimedia playback, and PC ...
s or other general-purpose applications consisting of various discrete chips. In modern terminology, a microcontroller is similar to, but less sophisticated than, a
system on a chip A system on a chip (SoC) is an integrated circuit that combines most or all key components of a computer or Electronics, electronic system onto a single microchip. Typically, an SoC includes a central processing unit (CPU) with computer memory, ...
(SoC). A SoC may include a microcontroller as one of its components but usually integrates it with advanced peripherals like a
graphics processing unit A graphics processing unit (GPU) is a specialized electronic circuit designed for digital image processing and to accelerate computer graphics, being present either as a discrete video card or embedded on motherboards, mobile phones, personal ...
(GPU), a
Wi-Fi Wi-Fi () is a family of wireless network protocols based on the IEEE 802.11 family of standards, which are commonly used for Wireless LAN, local area networking of devices and Internet access, allowing nearby digital devices to exchange data by ...
module, or one or more
coprocessor A coprocessor is a computer processor used to supplement the functions of the primary processor (the CPU). Operations performed by the coprocessor may be floating-point arithmetic, graphics, signal processing, string processing, cryptography or ...
s. 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 system An embedded system is a specialized computer system—a combination of a computer processor, computer memory, and input/output peripheral devices—that has a dedicated function within a larger mechanical or electronic system. It is e ...
s. By reducing the size and cost compared to a design that uses a separate
microprocessor A microprocessor is a computer processor (computing), processor for which the data processing logic and control is included on a single integrated circuit (IC), or a small number of ICs. The microprocessor contains the arithmetic, logic, a ...
, memory, and input/output devices, microcontrollers make digital control of more devices and processes practical.
Mixed-signal A mixed-signal integrated circuit is any integrated circuit that has both analog circuits and digital circuits on a single semiconductor die.Internet of Things Internet of things (IoT) describes devices with sensors, processing ability, software and other technologies that connect and exchange data with other devices and systems over the Internet or other communication networks. The IoT encompasse ...
, microcontrollers are an economical and popular means of
data collection Data collection or data gathering is the process of gathering and measuring information on targeted variables in an established system, which then enables one to answer relevant questions and evaluate outcomes. Data collection is a research com ...
, sensing and actuating the physical world as
edge device Edge or EDGE may refer to: Technology Computing * Edge computing, a network load-balancing system * Edge device, an entry point to a computer network * Adobe Edge, a graphical development application * Microsoft Edge, a web browser developed by ...
s. Some microcontrollers may use four-bit
words A word is a basic element of language that carries meaning, can be used on its own, and is uninterruptible. Despite the fact that language speakers often have an intuitive grasp of what a word is, there is no consensus among linguists on its ...
and operate at frequencies as low as for low
power consumption Electric energy consumption is energy consumption in the form of electrical energy. About a fifth of global energy is consumed as electricity: for residential, industrial, commercial, transportation and other purposes. The global electricity con ...
(single-digit milliwatts or microwatts). They generally have the ability to retain functionality while waiting for an event such as a button press or other
interrupt In digital computers, an interrupt (sometimes referred to as a trap) is a request for the processor to ''interrupt'' currently executing code (when permitted), so that the event can be processed in a timely manner. If the request is accepted ...
; power consumption while sleeping (with the 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 A digital signal processor (DSP) is a specialized microprocessor chip, with its architecture optimized for the operational needs of digital signal processing. DSPs are fabricated on metal–oxide–semiconductor (MOS) integrated circuit chips. ...
(DSP), with higher clock speeds and power consumption.


History


Background

The first multi-chip microprocessors, the
Four-Phase Systems AL1 Four-Phase Systems, Inc., was a computer company, founded by Lee Boysel and others, which built one of the earliest computers using semiconductor main memory and metal–oxide–semiconductor, MOS large-scale integration, LSI logic. The company w ...
in 1969 and the
Garrett AiResearch Garrett AiResearch was a manufacturer of turboprop engines and turbochargers, and a pioneer in numerous aerospace technologies. It was previously known as Aircraft Tool and Supply Company, Garrett Supply Company, AiResearch Manufacturing Compa ...
MP944 The F-14's Central Air Data Computer, also abbreviated as CADC, computes altitude, vertical speed, air speed, and mach number from sensor inputs such as pitot and static pressure and temperature. From 1968 to 1970, the first CADC to use custom ...
in 1970, were developed with multiple MOS LSI chips. The first single-chip microprocessor was the
Intel 4004 The Intel 4004 was part of the 4 chip MCS-4 micro computer set, released by the Intel, Intel Corporation in November 1971; the 4004 being part of the first commercially marketed microprocessor chipset, and the first in a long line of List of I ...
, released on a single MOS LSI chip in 1971. It was developed by
Federico Faggin Federico Faggin (, ; born 1 December 1941) is an Italian-American physicist, engineer, inventor and entrepreneur. He is best known for designing the first commercial microprocessor, the Intel 4004. He led the 4004 (MCS-4) project and the desig ...
, using his
silicon-gate In semiconductor electronics fabrication technology, a self-aligned gate is a transistor manufacturing approach whereby the gate electrode of a MOSFET (metal–oxide–semiconductor field-effect transistor) is used as a mask for the doping of the ...
MOS technology, along with
Intel Intel Corporation is an American multinational corporation and technology company headquartered in Santa Clara, California, and Delaware General Corporation Law, incorporated in Delaware. Intel designs, manufactures, and sells computer compo ...
engineers
Marcian Hoff Marcian Edward "Ted" Hoff Jr. (born October 28, 1937, in Rochester, New York) is one of the inventors of the microprocessor. Education and work history Hoff received a bachelor's degree in electrical engineering from the Rensselaer Polytechnic In ...
and Stan Mazor, and
Busicom was a Japanese company that manufactured and sold computer-related products headquartered in Taito, Tokyo. It owned the rights to Intel's first microprocessor, the Intel 4004, which they created in partnership with Intel in 1970. Busicom aske ...
engineer
Masatoshi Shima is a Japanese electronics engineer. He was one of the architects of the world's first microprocessor, the Intel 4004. In 1968, Shima worked for Busicom in Japan, and did the logic design for a specialized CPU to be translated into three-chip c ...
. It was followed by the
4-bit 4-bit computing is the use of computer architectures in which integer (computer science), integers and other data (computer science), data units are 4 bits wide. 4-bit central processing unit (CPU) and arithmetic logic unit (ALU) architectures a ...
Intel 4040 The Intel 4040 ("''forty-forty''") is the second 4-bit microprocessor designed and manufactured by Intel. Introduced in 1974 as a successor to the Intel 4004, the 4040 was produced with a 10 μm process and includes silicon gate enhancem ...
, the
8-bit In computer architecture, 8-bit integers or other data units are those that are 8 bits wide (1 octet). Also, 8-bit central processing unit (CPU) and arithmetic logic unit (ALU) architectures are those that are based on registers or data bu ...
Intel 8008 The Intel 8008 ("''eight-thousand-eight''" or "''eighty-oh-eight''") is an early 8-bit microprocessor capable of addressing 16 KB of memory, introduced in April 1972. The 8008 architecture was designed by Computer Terminal Corporation (CTC) and ...
, and the 8-bit
Intel 8080 The Intel 8080 is Intel's second 8-bit computing, 8-bit microprocessor. Introduced in April 1974, the 8080 was an enhanced successor to the earlier Intel 8008 microprocessor, although without binary compatibility.'' Electronic News'' was a week ...
. All of these processors required several external chips to implement a working system, including memory and peripheral interface chips. As a result, the total system cost was several hundred (1970s US) dollars, making it impossible to economically computerize small appliances.
MOS Technology MOS Technology, Inc. ("MOS" being short for Metal Oxide Semiconductor), later known as CSG (Commodore Semiconductor Group) and GMT Microelectronics, was a semiconductor design and fabrication company based in Audubon, Pennsylvania. It is ...
introduced its sub-$100 microprocessors in 1975, the 6501 and
6502 The MOS Technology 6502 (typically pronounced "sixty-five-oh-two" or "six-five-oh-two") William Mensch and the moderator both pronounce the 6502 microprocessor as ''"sixty-five-oh-two"''. is an 8-bit microprocessor that was designed by a small ...
. Their chief aim was to reduce this cost barrier but these microprocessors still required external support, memory, and peripheral chips which kept the total system cost in the hundreds of dollars.


Development

One book credits TI engineers Gary Boone and Michael Cochran with the successful creation of the first microcontroller in 1971. The result of their work was the
TMS 1000 The TMS1000 is a family of microcontrollers introduced by Texas Instruments in 1974. It combines a 4-bit central processor unit, read-only memory (ROM), random access memory (RAM), and input/output (I/O) lines as a complete "computer on a chip". I ...
, which became commercially available in 1974. It combined read-only memory, read/write memory, processor and clock on one chip and was targeted at embedded systems. During the early-to-mid-1970s, Japanese electronics manufacturers began producing microcontrollers for automobiles, including 4-bit MCUs for
in-car entertainment In-car entertainment (ICE), or in-vehicle infotainment (IVI), is a collection of hardware and software in automobiles that provides audio or video entertainment. In car entertainment originated with car audio systems that consisted of radios and c ...
, automatic wipers, electronic locks, and dashboard, and 8-bit MCUs for engine control. Partly in response to the existence of the single-chip TMS 1000, Intel developed a computer system on a chip optimized for control applications, the Intel 8048, with commercial parts first shipping in 1977. It combined
RAM Ram, ram, or RAM most commonly refers to: * A male sheep * Random-access memory, computer memory * Ram Trucks, US, since 2009 ** List of vehicles named Dodge Ram, trucks and vans ** Ram Pickup, produced by Ram Trucks Ram, ram, or RAM may also ref ...
and
ROM Rom, or ROM may refer to: Biomechanics and medicine * Risk of mortality, a medical classification to estimate the likelihood of death for a patient * Rupture of membranes, a term used during pregnancy to describe a rupture of the amniotic sac * ...
on the same chip with a microprocessor. Among numerous applications, this chip would eventually find its way into over one billion PC keyboards. At that time Intel's President, Luke J. Valenter, stated that the microcontroller was one of the most successful products in the company's history, and he expanded the microcontroller division's budget by over 25%. Most microcontrollers at this time had concurrent variants. One had
EPROM An EPROM (rarely EROM), or erasable programmable read-only memory, is a type of programmable read-only memory (PROM) integrated circuit, chip that retains its data when its power supply is switched off. Computer memory that can retrieve stored d ...
program memory, with a transparent quartz window in the lid of the package to allow it to be erased by exposure to
ultraviolet Ultraviolet radiation, also known as simply UV, is electromagnetic radiation of wavelengths of 10–400 nanometers, shorter than that of visible light, but longer than X-rays. UV radiation is present in sunlight and constitutes about 10% of ...
light. These erasable chips were often used for prototyping. The other variant was either a mask-programmed ROM or a
PROM A promenade dance or prom is a formal dance party for graduating high school students at the end of the school year. Students participating in the prom will typically vote for a ''prom king'' and ''prom queen''. Other students may be honored ...
variant which was only programmable once. For the latter, sometimes the designation ''OTP'' was used, standing for "one-time programmable". In an OTP microcontroller, the PROM was usually of identical type as the EPROM, but the chip package had no quartz window; because there was no way to expose the EPROM to ultraviolet light, it could not be erased. Because the erasable versions required ceramic packages with quartz windows, they were significantly more expensive than the OTP versions, which could be made in lower-cost opaque plastic packages. For the erasable variants, quartz was required, instead of less expensive glass, for its transparency to ultraviolet light—to which glass is largely opaque—but the main cost differentiator was the ceramic package itself. Piggyback microcontrollers were also used. In 1993, the introduction of
EEPROM EEPROM or E2PROM (electrically erasable programmable read-only memory) is a type of non-volatile memory. It is used in computers, usually integrated in microcontrollers such as smart cards and remote keyless systems, or as a separate chip d ...
memory allowed microcontrollers (beginning with the Microchip PIC16C84) to be electrically erased quickly without an expensive package as required for
EPROM An EPROM (rarely EROM), or erasable programmable read-only memory, is a type of programmable read-only memory (PROM) integrated circuit, chip that retains its data when its power supply is switched off. Computer memory that can retrieve stored d ...
, allowing both rapid prototyping, and in-system programming. (EEPROM technology had been available prior to this time, but the earlier EEPROM was more expensive and less durable, making it unsuitable for low-cost mass-produced microcontrollers.) The same year, Atmel introduced the first microcontroller using
Flash memory Flash memory is an Integrated circuit, electronic Non-volatile memory, non-volatile computer memory storage medium that can be electrically erased and reprogrammed. The two main types of flash memory, NOR flash and NAND flash, are named for t ...
, a special type of EEPROM. Other companies rapidly followed suit, with both memory types. Nowadays microcontrollers are cheap and readily available for hobbyists, with large online communities around certain processors.


Volume and cost

In 2002, about 55% of all CPUs sold in the world were 8-bit microcontrollers and microprocessors. Over two billion 8-bit microcontrollers were sold in 1997, and according to Semico, over four billion 8-bit microcontrollers were sold in 2006. More recently, Semico has claimed the MCU market grew 36.5% in 2010 and 12% in 2011. A typical home in a developed country is likely to have only four general-purpose microprocessors but around three dozen microcontrollers. A typical mid-range automobile has about 30 microcontrollers. They can also be found in many electrical devices such as washing machines, microwave ovens, and telephones. Cost to manufacture can be under per unit. Cost has plummeted over time, with the cheapest
8-bit In computer architecture, 8-bit integers or other data units are those that are 8 bits wide (1 octet). Also, 8-bit central processing unit (CPU) and arithmetic logic unit (ALU) architectures are those that are based on registers or data bu ...
microcontrollers being available for under in 2018, and some
32-bit In computer architecture, 32-bit computing refers to computer systems with a processor, memory, and other major system components that operate on data in a maximum of 32- bit units. Compared to smaller bit widths, 32-bit computers can perform la ...
microcontrollers around for similar quantities. In 2012, following a global crisis—a worst ever annual sales decline and recovery and average sales price year-over-year plunging 17%—the biggest reduction since the 1980s—the average price for a microcontroller was ( for 4-/8-bit, for 16-bit, for 32-bit). In 2012, worldwide sales of 8-bit microcontrollers were around , while
4-bit 4-bit computing is the use of computer architectures in which integer (computer science), integers and other data (computer science), data units are 4 bits wide. 4-bit central processing unit (CPU) and arithmetic logic unit (ALU) architectures a ...
microcontrollers also saw significant sales. In 2015, 8-bit microcontrollers could be bought for (1,000 units), 16-bit for (1,000 units), and 32-bit for (1,000 units, but at for 5,000). In 2018, 8-bit microcontrollers could be bought for , 16-bit for (1,000 units, but at for 100 or for full reel of 2,000), and 32-bit for (1,000 units, but at for 5,000). In 2018, the low-priced microcontrollers above from 2015 were all more expensive (with inflation calculated between 2018 and 2015 prices for those specific units) at: the 8-bit microcontroller could be bought for (1,000 units) or 2.6% higher, the 16-bit one for (1,000 units) or 21% higher, and the 32-bit one for (1,000 units, but at for 5,000) or 33% higher.


Smallest computer

On 21 June 2018, the "world's smallest computer" was announced by the
University of Michigan The University of Michigan (U-M, U of M, or Michigan) is a public university, public research university in Ann Arbor, Michigan, United States. Founded in 1817, it is the oldest institution of higher education in the state. The University of Mi ...
. The device is a " wireless and batteryless sensor system with integrated
Cortex-M0+ The ARM Cortex-M is a group of 32-bit RISC ARM processor cores licensed by ARM Limited. These cores are optimized for low-cost and energy-efficient integrated circuits, which have been embedded in tens of billions of consumer devices. Thoug ...
processor and optical communication for cellular temperature measurement." It "measures just to a side—dwarfed by a grain of rice. ..In addition to the RAM and
photovoltaics Photovoltaics (PV) is the conversion of light into electricity using semiconducting materials that exhibit the photovoltaic effect, a phenomenon studied in physics, photochemistry, and electrochemistry. The photovoltaic effect is commerciall ...
, the new computing devices have processors and wireless transmitters and receivers. Because they are too small to have conventional radio antennae, they receive and transmit data with visible light. A base station provides light for power and programming, and it receives the data." The device is th the size of IBM's previously claimed world-record-sized computer from months back in March 2018, which is "smaller than a grain of salt", has a million transistors, costs less than to manufacture, and, combined with
blockchain The blockchain is a distributed ledger with growing lists of Record (computer science), records (''blocks'') that are securely linked together via Cryptographic hash function, cryptographic hashes. Each block contains a cryptographic hash of th ...
technology, is intended for logistics and "crypto-anchors"— digital fingerprint applications.


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 An embedded system is a specialized computer system—a combination of a computer processor, computer memory, and input/output peripheral devices—that has a dedicated function within a larger mechanical or electronic system. It is e ...
. 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 An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ...
, and low software complexity. Typical input and output devices include switches,
relay A relay Electromechanical relay schematic showing a control coil, four pairs of normally open and one pair of normally closed contacts An automotive-style miniature relay with the dust cover taken off A relay is an electrically operated switc ...
s,
solenoid upright=1.20, An illustration of a solenoid upright=1.20, Magnetic field created by a seven-loop solenoid (cross-sectional view) described using field lines A solenoid () is a type of electromagnet formed by a helix, helical coil of wire whos ...
s,
LED A light-emitting diode (LED) is a semiconductor device that emits light when current flows through it. Electrons in the semiconductor recombine with electron holes, releasing energy in the form of photons. The color of the light (corresp ...
's, small or custom
liquid-crystal display A liquid-crystal display (LCD) is a flat-panel display or other Electro-optic modulator, electronically modulated optical device that uses the light-modulating properties of liquid crystals combined with polarizers to display information. Liq ...
s, 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 A personal computer, commonly referred to as PC or computer, is a computer designed for individual use. It is typically used for tasks such as Word processor, word processing, web browser, internet browsing, email, multimedia playback, and PC ...
, and may lack human interaction devices of any kind.


Interrupts

Microcontrollers must provide
real-time Real-time, realtime, or real time may refer to: Computing * Real-time computing, hardware and software systems subject to a specified time constraint * Real-time clock, a computer clock that keeps track of the current time * Real-time Control Syst ...
(predictable, though not necessarily fast) response to events in the embedded system they are controlling. When certain events occur, an
interrupt In digital computers, an interrupt (sometimes referred to as a trap) is a request for the processor to ''interrupt'' currently executing code (when permitted), so that the event can be processed in a timely manner. If the request is accepted ...
system can signal the processor to suspend processing the current instruction sequence and to begin an interrupt service routine (ISR, or "interrupt handler") which 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 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.


Programs

Typically microcontroller programs must fit in the available on-chip memory, since it would be costly to provide a system with external, expandable memory. Compilers and assemblers are used to convert both high-level and
assembly language In computing, assembly language (alternatively assembler language or symbolic machine code), often referred to simply as assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence bet ...
code into a compact
machine code In computer programming, machine code is computer code consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). For conventional binary computers, machine code is the binaryOn nonb ...
for storage in the microcontroller's memory. Depending on the device, the program memory may be permanent,
read-only memory Read-only memory (ROM) is a type of non-volatile memory used in computers and other electronic devices. Data stored in ROM cannot be electronically modified after the manufacture of the memory device. Read-only memory is useful for storing sof ...
that can only be programmed at the factory, or it may be field-alterable
flash Flash, flashes, or FLASH may refer to: Arts, entertainment, and media Fictional aliases * The Flash, several DC Comics superheroes with super speed: ** Flash (Jay Garrick) ** Barry Allen ** Wally West, the first Kid Flash and third adult Flash ...
or erasable read-only memory. Manufacturers have often produced special versions of their microcontrollers in order to help the hardware and
software development Software development is the process of designing and Implementation, implementing a software solution to Computer user satisfaction, satisfy a User (computing), user. The process is more encompassing than Computer programming, programming, wri ...
of the target system. Originally these included
EPROM An EPROM (rarely EROM), or erasable programmable read-only memory, is a type of programmable read-only memory (PROM) integrated circuit, chip that retains its data when its power supply is switched off. Computer memory that can retrieve stored d ...
versions that have a "window" on the top of the device through which program memory can be erased by
ultraviolet Ultraviolet radiation, also known as simply UV, is electromagnetic radiation of wavelengths of 10–400 nanometers, shorter than that of visible light, but longer than X-rays. UV radiation is present in sunlight and constitutes about 10% of ...
light, ready for reprogramming after a programming ("burn") and test cycle. Since 1998, EPROM versions are rare and have been replaced by
EEPROM EEPROM or E2PROM (electrically erasable programmable read-only memory) is a type of non-volatile memory. It is used in computers, usually integrated in microcontrollers such as smart cards and remote keyless systems, or as a separate chip d ...
and flash, which are easier to use (can be erased electronically) and cheaper to manufacture. Other versions may be available where the ROM is accessed as an external device rather than as internal memory, however these are becoming rare due to the widespread availability of cheap microcontroller programmers. The use of field-programmable devices on a microcontroller may allow field update of the
firmware In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computer, computing machinery. It includes the study and experimentation of algorithmic processes, and the development of both computer hardware, h ...
or permit late factory revisions to products that have been assembled but not yet shipped. Programmable memory also reduces the lead time required for deployment of a new product. Where hundreds of thousands of identical devices are required, using parts programmed at the time of manufacture can be economical. These " mask-programmed" parts have the program laid down in the same way as the logic of the chip, at the same time. A customized microcontroller incorporates a block of digital logic that can be personalized for additional processing capability,
peripherals A peripheral device, or simply peripheral, is an auxiliary hardware device that a computer uses to transfer information externally. A peripheral is a hardware component that is accessible to and controlled by a computer but is not a core compo ...
and
interfaces Interface or interfacing may refer to: Academic journals * ''Interface'' (journal), by the Electrochemical Society * '' Interface, Journal of Applied Linguistics'', now merged with ''ITL International Journal of Applied Linguistics'' * '' Inter ...
that are adapted to the requirements of the application. One example is the AT91CAP from Atmel.


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, often indirectly, through external power electronics. Many embedded systems need to read sensors that produce analog signals. However, because they 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, an
analog-to-digital converter In electronics, an analog-to-digital converter (ADC, A/D, or A-to-D) is a system that converts an analog signal, such as a sound picked up by a microphone or light entering a digital camera, into a Digital signal (signal processing), digi ...
(ADC) 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 In electronics, a digital-to-analog converter (DAC, D/A, D2A, or D-to-A) is a system that converts a digital signal into an analog signal. An analog-to-digital converter (ADC) performs the reverse function. DACs are commonly used in musi ...
(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 In computing and in embedded systems, a programmable interval timer (PIT) is a counter that generates an output signal when it reaches a programmed count. The output signal may trigger an interrupt. Common features PITs may be one-shot or periodi ...
(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/off, the heater on/off, etc. A dedicated
pulse-width modulation Pulse-width modulation (PWM), also known as pulse-duration modulation (PDM) or pulse-length modulation (PLM), is any method of representing a signal as a rectangular wave with a varying duty cycle (and for some methods also a varying peri ...
(PWM) block makes it possible for the CPU to control power converters,
resistive The electrical resistance of an object is a measure of its opposition to the flow of electric current. Its reciprocal quantity is , measuring the ease with which an electric current passes. Electrical resistance shares some conceptual paral ...
loads,
motors An engine or motor is a machine designed to convert one or more forms of energy into mechanical energy. Available energy sources include potential energy (e.g. energy of the Earth's gravitational field as exploited in hydroelectric power gene ...
, etc., without using many CPU resources in tight timer loops. A
universal asynchronous receiver/transmitter A universal asynchronous receiver-transmitter (UART ) is a peripheral device for asynchronous serial communication in which the data format and transmission speeds are configurable. It sends data bits one by one, from the least significant to t ...
(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 Inter-Integrated Circuit (
I²C I2C (Inter-Integrated Circuit; pronounced as "" or ""), alternatively known as I2C and IIC, is a synchronous, multi-master/multi-slave, single-ended, serial communication bus invented in 1980 by Philips Semiconductors (now NXP Semiconduct ...
), Serial Peripheral Interface ( SPI), Universal Serial Bus (
USB Universal Serial Bus (USB) is an industry standard, developed by USB Implementers Forum (USB-IF), for digital data transmission and power delivery between many types of electronics. It specifies the architecture, in particular the physical ...
), and
Ethernet Ethernet ( ) is a family of wired computer networking technologies commonly used in local area networks (LAN), metropolitan area networks (MAN) and wide area networks (WAN). It was commercially introduced in 1980 and first standardized in 198 ...
.


Higher integration

Microcontrollers may not implement an external address or data bus as they integrate RAM and
non-volatile memory Non-volatile memory (NVM) or non-volatile storage is a type of computer memory that can retain stored information even after power is removed. In contrast, volatile memory needs constant power in order to retain data. Non-volatile memory typ ...
on the same chip as the CPU. Using fewer pins, the chip can be placed in a much smaller, cheaper package. Integrating the memory and other peripherals on a single chip and testing them as a unit increases the cost of that chip, but often results in decreased net cost of the embedded system as a whole. Even if the cost of a CPU that has integrated peripherals is slightly more than the cost of a CPU and external peripherals, having fewer chips typically allows a smaller and cheaper circuit board, and reduces the labor required to assemble and test the circuit board, in addition to tending to decrease the defect rate for the finished assembly. A microcontroller is a single
integrated circuit An integrated circuit (IC), also known as a microchip or simply chip, is a set of electronic circuits, consisting of various electronic components (such as transistors, resistors, and capacitors) and their interconnections. These components a ...
, commonly with the following features: *
central processing unit A central processing unit (CPU), also called a central processor, main processor, or just processor, is the primary Processor (computing), processor in a given computer. Its electronic circuitry executes Instruction (computing), instructions ...
ranging from small and simple
4-bit 4-bit computing is the use of computer architectures in which integer (computer science), integers and other data (computer science), data units are 4 bits wide. 4-bit central processing unit (CPU) and arithmetic logic unit (ALU) architectures a ...
processors to complex
32-bit In computer architecture, 32-bit computing refers to computer systems with a processor, memory, and other major system components that operate on data in a maximum of 32- bit units. Compared to smaller bit widths, 32-bit computers can perform la ...
or
64-bit In computer architecture, 64-bit integers, memory addresses, or other data units are those that are 64 bits wide. Also, 64-bit central processing units (CPU) and arithmetic logic units (ALU) are those that are based on processor registers, a ...
processors * volatile memory (
RAM Ram, ram, or RAM most commonly refers to: * A male sheep * Random-access memory, computer memory * Ram Trucks, US, since 2009 ** List of vehicles named Dodge Ram, trucks and vans ** Ram Pickup, produced by Ram Trucks Ram, ram, or RAM may also ref ...
) for data storage *
ROM Rom, or ROM may refer to: Biomechanics and medicine * Risk of mortality, a medical classification to estimate the likelihood of death for a patient * Rupture of membranes, a term used during pregnancy to describe a rupture of the amniotic sac * ...
,
EPROM An EPROM (rarely EROM), or erasable programmable read-only memory, is a type of programmable read-only memory (PROM) integrated circuit, chip that retains its data when its power supply is switched off. Computer memory that can retrieve stored d ...
,
EEPROM EEPROM or E2PROM (electrically erasable programmable read-only memory) is a type of non-volatile memory. It is used in computers, usually integrated in microcontrollers such as smart cards and remote keyless systems, or as a separate chip d ...
or
Flash memory Flash memory is an Integrated circuit, electronic Non-volatile memory, non-volatile computer memory storage medium that can be electrically erased and reprogrammed. The two main types of flash memory, NOR flash and NAND flash, are named for t ...
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 In computing, input/output (I/O, i/o, or informally io or IO) is the communication between an information processing system, such as a computer, and the outside world, such as another computer system, peripherals, or a human operator. Inputs a ...
such as
serial port A serial port is a serial communication Interface (computing), interface through which information transfers in or out sequentially one bit at a time. This is in contrast to a parallel port, which communicates multiple bits simultaneously in Pa ...
s (
UART A universal asynchronous receiver-transmitter (UART ) is a peripheral device for asynchronous serial communication in which the data format and transmission speeds are configurable. It sends data bits one by one, from the least significant to ...
s) * other
serial communications In telecommunication and data transmission, serial communication is the process of sending data one bit at a time, sequentially, over a communication channel or computer bus. This is in contrast to parallel communication, where several bits ar ...
interfaces Interface or interfacing may refer to: Academic journals * ''Interface'' (journal), by the Electrochemical Society * '' Interface, Journal of Applied Linguistics'', now merged with ''ITL International Journal of Applied Linguistics'' * '' Inter ...
like
I²C I2C (Inter-Integrated Circuit; pronounced as "" or ""), alternatively known as I2C and IIC, is a synchronous, multi-master/multi-slave, single-ended, serial communication bus invented in 1980 by Philips Semiconductors (now NXP Semiconduct ...
,
Serial Peripheral Interface Serial Peripheral Interface (SPI) is a de facto standard (with many variants) for synchronous serial communication, used primarily in embedded systems for short-distance wired communication between integrated circuits. SPI follows a master� ...
and
Controller Area Network A controller area network bus (CAN bus) is a vehicle bus standard designed to enable efficient communication primarily between electronic control units (ECUs). Originally developed to reduce the complexity and cost of electrical wiring in aut ...
for system interconnect *
peripheral A peripheral device, or simply peripheral, is an auxiliary hardware device that a computer uses to transfer information externally. A peripheral is a hardware component that is accessible to and controlled by a computer but is not a core compo ...
s such as
timer A timer or countdown timer is a type of clock that starts from a specified time duration and stops upon reaching 00:00. It can also usually be stopped manually before the whole duration has elapsed. An example of a simple timer is an hourglass ...
s, event counters, PWM generators, and
watchdog Watchdog or watch dog may refer to: Animals *Guard dog, a dog that barks to alert its owners of an intruder's presence * Portuguese Watchdog, Cão de Castro Laboreiro, a dog breed * Moscow Watchdog, a breed of dog that was bred in the Soviet U ...
*
clock generator A clock generator is an electronic oscillator that produces a clock signal for use in synchronizing a circuit's operation. The output clock signal can range from a simple symmetrical square wave to more complex arrangements. The basic parts tha ...
often an oscillator for a quartz timing crystal, resonator or
RC circuit A resistor–capacitor circuit (RC circuit), or RC filter or RC network, is an electric circuit composed of resistors and capacitors. It may be driven by a voltage source, voltage or current source and these will produce different responses. A fi ...
* many include analog-to-digital converters, some include digital-to-analog converters * in-circuit programming and in-circuit debugging support This integration drastically reduces the number of chips and the amount of wiring and
circuit board A printed circuit board (PCB), also called printed wiring board (PWB), is a laminated sandwich structure of conductive and insulating layers, each with a pattern of traces, planes and other features (similar to wires on a flat surface) ...
space that would be needed to produce equivalent systems using separate chips. Furthermore, on low pin count devices in particular, each pin may interface to several internal peripherals, with the pin function selected by software. This allows a part to be used in a wider variety of applications than if pins had dedicated functions. Microcontrollers have proved to be highly popular in
embedded system An embedded system is a specialized computer system—a combination of a computer processor, computer memory, and input/output peripheral devices—that has a dedicated function within a larger mechanical or electronic system. It is e ...
s since their introduction in the 1970s. Some microcontrollers use a
Harvard architecture The Harvard architecture is a computer architecture with separate computer storage, storage and signal pathways for Machine code, instructions and data. It is often contrasted with the von Neumann architecture, where program instructions and d ...
: separate memory buses for instructions and data, allowing accesses to take place concurrently. Where a Harvard architecture is used, instruction words for the processor may be a different bit size than the length of internal memory and registers; for example: 12-bit instructions used with 8-bit data registers. The decision of which peripheral to integrate is often difficult. 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. Microcontroller architectures vary widely. Some designs include general-purpose microprocessor cores, with one or more ROM, RAM, or I/O functions integrated onto the package. Other designs are purpose-built for control applications. A microcontroller instruction set usually has many instructions intended for
bit manipulation Bit manipulation is the act of algorithmically manipulating bits or other pieces of data shorter than a word. Computer programming tasks that require bit manipulation include low-level device control, error detection and error correction, corr ...
(bit-wise operations) to make control programs more compact. For example, a general-purpose processor might require several instructions to test a bit in a register and branch if the bit is set, where a microcontroller could have a single instruction to provide that commonly required function. Microcontrollers historically have not had math coprocessors, so
floating-point arithmetic In computing, floating-point arithmetic (FP) is arithmetic on subsets of real numbers formed by a ''significand'' (a Sign (mathematics), signed sequence of a fixed number of digits in some Radix, base) multiplied by an integer power of that ba ...
has been performed by software. However, some recent designs do include FPUs and DSP-optimized features. An example would be Microchip's PIC32 MIPS-based line.


Programming environments

Microcontrollers were originally programmed only in
assembly language In computing, assembly language (alternatively assembler language or symbolic machine code), often referred to simply as assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence bet ...
, but various
high-level programming language A high-level programming language is a programming language with strong Abstraction (computer science), abstraction from the details of the computer. In contrast to low-level programming languages, it may use natural language ''elements'', be ea ...
s, such as C, Python and
JavaScript JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior. Web browsers have ...
, are now also in common use to target microcontrollers and
embedded systems An embedded system is a specialized computer system—a combination of a computer processor, computer memory, and input/output peripheral devices—that has a dedicated function within a larger mechanical or electronic system. It is em ...
.
Compiler In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
s for
general-purpose language A general-purpose language is a computer language that is broadly applicable across Domain (software engineering), application domains, and lacks specialized features for a particular domain. This is in contrast to a domain-specific language (DSL), ...
s 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. Microcontroller vendors often make tools freely available to make it easier to adopt their hardware. Microcontrollers with specialty hardware may require their own non-standard dialects of C, such as SDCC for the 8051, which prevent using standard tools (such as code libraries or static analysis tools) even for code unrelated to hardware features.
Interpreters Interpreting is translation from a spoken or signed language into another language, usually in real time to facilitate live communication. It is distinguished from the translation of a written text, which can be more deliberative and make use o ...
may also contain nonstandard features, such as
MicroPython MicroPython is a software implementation of a programming language largely compatible with Python 3, written in C, that is optimized to run on a microcontroller. MicroPython consists of a Python compiler to bytecode and a runtime interpreter o ...
, although a fork,
CircuitPython CircuitPython is an open-source derivative of the MicroPython programming language targeted toward students and beginners. Development of CircuitPython is supported by Adafruit Industries. It is a software implementation of the programming langua ...
, has looked to move hardware dependencies to libraries and have the language adhere to a more
CPython CPython is the reference implementation of the Python programming language. Written in C and Python, CPython is the default and most widely used implementation of the Python language. CPython can be defined as both an interpreter and a comp ...
standard. Interpreter firmware is also available for some microcontrollers. For example,
BASIC Basic or BASIC may refer to: Science and technology * BASIC, a computer programming language * Basic (chemistry), having the properties of a base * Basic access authentication, in HTTP Entertainment * Basic (film), ''Basic'' (film), a 2003 film ...
on the early microcontroller
Intel Intel Corporation is an American multinational corporation and technology company headquartered in Santa Clara, California, and Delaware General Corporation Law, incorporated in Delaware. Intel designs, manufactures, and sells computer compo ...
8052; BASIC and FORTH on the
Zilog Z8 The Zilog Z8 is a microcontroller architecture, originally introduced by Zilog in 1979. Today the line also includes the Z8 Encore!, eZ8 Encore!, eZ8 Encore! XP, and eZ8 Encore! MC families. Signifying features of the architecture are up to 4 ...
as well as some modern devices. Typically these interpreters support
interactive programming Interactive programming is the procedure of writing parts of a program while it is already active. This focuses on the program text as the main interface for a running process, rather than an interactive application, where the program is desig ...
. 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. A
simulator A simulation is an imitative representation of a process or system that could exist in the real world. In this broad sense, simulation can often be used interchangeably with model. Sometimes a clear distinction between the two terms is made, in ...
will show the internal processor state and also that of the outputs, as well as allowing input signals to be generated. While on the one hand most simulators will be limited from being unable to simulate much other hardware in a system, they can exercise conditions that may otherwise be hard to reproduce at will in the physical implementation, and can be the quickest way to debug and analyze problems. Recent microcontrollers are often integrated with on-chip
debug In engineering, debugging is the process of finding the root cause, workarounds, and possible fixes for bugs. For software, debugging tactics can involve interactive debugging, control flow analysis, log file analysis, monitoring at the ap ...
circuitry that when accessed by an
in-circuit emulator In-circuit emulation (ICE) is the use of a hardware device or in-circuit emulator used to debug the software of an embedded system. It operates by using a processor with the additional ability to support debugging operations, as well as to carr ...
(ICE) via
JTAG JTAG (named after the Joint Test Action Group which codified it) is an industry standard for verifying designs of and testing printed circuit boards after manufacture. JTAG implements standards for on-chip instrumentation in electronic design ...
, allow debugging of the firmware with a
debugger A debugger is a computer program used to test and debug other programs (the "target" programs). Common features of debuggers include the ability to run or halt the target program using breakpoints, step through code line by line, and display ...
. A real-time ICE may allow viewing and/or manipulating of internal states while running. A tracing ICE can record executed program and MCU states before/after a trigger point.


Types

, there are several dozen microcontroller architectures and vendors including: *
ARM In human anatomy, the arm refers to the upper limb in common usage, although academically the term specifically means the upper arm between the glenohumeral joint (shoulder joint) and the elbow joint. The distal part of the upper limb between ...
core processors (many vendors) **
ARM Cortex-M The ARM Cortex-M is a group of 32-bit RISC ARM processor cores licensed by ARM Limited. These cores are optimized for low-cost and energy-efficient integrated circuits, which have been embedded in tens of billions of consumer devices. Thoug ...
cores are specifically targeted toward microcontroller applications *
Microchip Technology Microchip Technology Incorporated is a publicly listed American semiconductor corporation that manufactures microcontroller, mixed-signal, analog, and Flash-IP integrated circuits. Its corporate headquarters is located in Chandler, Arizona. ...
Atmel AVR AVR is a family of microcontrollers developed since 1996 by Atmel, acquired by Microchip Technology in 2016. They are 8-bit RISC single-chip microcontrollers based on a modified Harvard architecture. AVR was one of the first microcontroller ...
(8-bit),
AVR32 AVR32 is a 32-bit RISC microcontroller architecture produced by Atmel. The microcontroller architecture was designed by a handful of people educated at the Norwegian University of Science and Technology, including lead designer Øyvind Strøm ...
(32-bit), and AT91SAM (32-bit) *
Cypress Semiconductor Cypress Semiconductor Corporation was an American semiconductor design and manufacturing company. It offered NOR flash memories, F-RAM and SRAM Traveo microcontrollers, PSoCs, PMICs, capacitive touch-sensing controllers, Wireless BLE Bluet ...
's M8C core used in their Cypress PSoC * Freescale ColdFire (32-bit) and S08 (8-bit) * Freescale 68HC11 (8-bit), and others based on the Motorola 6800 family *
Intel 8051 The Intel MCS-51 (commonly termed 8051) is a single-chip microcontroller (MCU) series developed by Intel in 1980 for use in embedded systems. The architect of the Intel MCS-51 instruction set was John H. Wharton.. Intel's original versions w ...
, also manufactured by
NXP Semiconductors NXP Semiconductors N.V. is a Dutch semiconductor manufacturing and design company with headquarters in Eindhoven, Netherlands. It is the third largest European semiconductor company by market capitalization as of 2024. The company employs approx ...
, Infineon and many others *
Infineon Infineon Semiconductor solutions is the largest microcontroller manufacturer in the world, as well as Germany's largest semiconductor manufacturer. It is also the leading automotive semiconductor manufacturer globally. Infineon had roughly 58,0 ...
: 8-bit XC800, 16-bit XE166, 32-bit XMC4000 (ARM based Cortex M4F), 32-bit TriCore and, 32-bit Aurix Tricore Bit microcontrollerswww.infineon.com/mcu
/ref> *
Maxim Integrated Maxim Integrated Products, Inc., was an American semiconductor company that designed, manufactured, and sold analog and mixed-signal integrated circuits for the automotive, industrial, communications, consumer, and computing markets. Maxim's pr ...
MAX32600, MAX32620, MAX32625, MAX32630, MAX32650, MAX32640 * MIPS *
Microchip Technology Microchip Technology Incorporated is a publicly listed American semiconductor corporation that manufactures microcontroller, mixed-signal, analog, and Flash-IP integrated circuits. Its corporate headquarters is located in Chandler, Arizona. ...
PIC, (8-bit PIC16, PIC18, 16-bit dsPIC33 / PIC24), (32-bit PIC32) *
NXP Semiconductors NXP Semiconductors N.V. is a Dutch semiconductor manufacturing and design company with headquarters in Eindhoven, Netherlands. It is the third largest European semiconductor company by market capitalization as of 2024. The company employs approx ...
LPC1000, LPC2000, LPC3000, LPC4000 (32-bit), LPC900, LPC700 (8-bit) *
Parallax Propeller The Parallax P8X32A Propeller is a multi-core processor parallel computer architecture microcontroller chip with eight 32-bit reduced instruction set computer (RISC) central processing unit (CPU) cores. Introduced in 2006, it is designed and so ...
*
PowerPC PowerPC (with the backronym Performance Optimization With Enhanced RISC – Performance Computing, sometimes abbreviated as PPC) is a reduced instruction set computer (RISC) instruction set architecture (ISA) created by the 1991 Apple Inc., App ...
ISE * Rabbit 2000 (8-bit) *
Renesas Electronics is a Japanese semiconductor manufacturer headquartered in Tokyo. The name "Renesas" is a contraction of "Renaissance Semiconductor for Advanced Solutions." The company was established in 2002 as Renesas Technology through the merger of the semi ...
: RL78 16-bit MCU; RX 32-bit MCU;
SuperH SuperH (or SH) is a 32-bit reduced instruction set computing (RISC) instruction set architecture (ISA) developed by Hitachi and currently produced by Renesas. It is implemented by microcontrollers and microprocessors for embedded systems. At the ...
; V850 32-bit MCU; H8; R8C 16-bit MCU * Silicon Laboratories Pipelined 8-bit 8051 microcontrollers and mixed-signal ARM-based 32-bit microcontrollers *
STMicroelectronics STMicroelectronics Naamloze vennootschap, NV (commonly referred to as ST or STMicro) is a European multinational corporation, multinational semiconductor contract manufacturing and design company. It is the largest of such companies in Europe. ...
STM8 The STM8 is an 8-bit microcontroller family by STMicroelectronics. The STM8 microcontrollers use an extended variant of the ST6 and ST7, ST7 microcontroller architecture. STM8 microcontrollers are particularly low cost for a full-featured 8-bit m ...
(8-bit), ST10 (16-bit), STM32 (32-bit)
SPC5
(automotive 32-bit) *
Texas Instruments Texas Instruments Incorporated (TI) is an American multinational semiconductor company headquartered in Dallas, Texas. It is one of the top 10 semiconductor companies worldwide based on sales volume. The company's focus is on developing analog ...
TI MSP430 (16-bit)
MSP432
(32-bit), C2000 (32-bit) * Toshiba TLCS-870 (8-bit/16-bit) Many others exist, some of which are used in very narrow range of applications or are more like applications processors than microcontrollers. The microcontroller market is extremely fragmented, with numerous vendors, technologies, and markets. Note that many vendors sell or have sold multiple architectures.


Interrupt latency

In contrast to general-purpose computers, microcontrollers used in embedded systems often seek to optimize
interrupt latency In computing, interrupt latency refers to the delay between the start of an Interrupt Request (IRQ) and the start of the respective Interrupt Service Routine (ISR). For many operating systems, devices are serviced as soon as the device's interru ...
over instruction throughput. Issues include both reducing the latency, and making it be more predictable (to support real-time control). When an electronic device causes an interrupt, during the
context switch In computing, a context switch is the process of storing the state of a process or thread, so that it can be restored and resume execution at a later point, and then restoring a different, previously saved, state. This allows multiple processes ...
the intermediate results (registers) have to be saved before the software responsible for handling the interrupt can run. They must also be restored after that
interrupt handler In computer systems programming, an interrupt handler, also known as an interrupt service routine (ISR), is a special block of code associated with a specific interrupt condition. Interrupt handlers are initiated by hardware interrupts, software ...
is finished. If there are more
processor register A processor register is a quickly accessible location available to a computer's processor. Registers usually consist of a small amount of fast storage, although some registers have specific hardware functions, and may be read-only or write-onl ...
s, this saving and restoring process may take more time, increasing the latency. (If an ISR does not require the use of some registers, it may simply leave them alone rather than saving and restoring them, so in that case those registers are not involved with the latency.) 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), or at least having the hardware not save them all (this fails if the software then needs to compensate by saving the rest "manually"). Another technique involves spending silicon gates on "shadow registers": One or more duplicate registers used only by the interrupt software, perhaps supporting a dedicated stack. Other factors affecting interrupt latency include: * Cycles needed to complete current CPU activities. To minimize those costs, microcontrollers tend to have short pipelines (often three instructions or less), small write buffers, and ensure that longer instructions are continuable or restartable.
RISC In electronics and computer science, a reduced instruction set computer (RISC) is a computer architecture designed to simplify the individual instructions given to the computer to accomplish tasks. Compared to the instructions given to a comp ...
design principles ensure that most instructions take the same number of cycles, helping avoid the need for most such continuation/restart logic. * The length of any
critical section In concurrent programming, concurrent accesses to shared resources can lead to unexpected or erroneous behavior. Thus, the parts of the program where the shared resource is accessed need to be protected in ways that avoid the concurrent access. One ...
that needs to be interrupted. Entry to a critical section restricts concurrent data structure access. When a data structure must be accessed by an interrupt handler, the critical section must block that interrupt. Accordingly, interrupt latency is increased by however long that interrupt is blocked. When there are hard external constraints on system latency, developers often need tools to measure interrupt latencies and track down which critical sections cause slowdowns. ** One common technique just blocks all interrupts for the duration of the critical section. This is easy to implement, but sometimes critical sections get uncomfortably long. ** A more complex technique just blocks the interrupts that may trigger access to that data structure. This is often based on interrupt priorities, which tend to not correspond well to the relevant system data structures. Accordingly, this technique is used mostly in very constrained environments. ** Processors may have hardware support for some critical sections. Examples include supporting atomic access to bits or bytes within a word, or other atomic access primitives like the LDREX/STREX exclusive access primitives introduced in the ARMv6 architecture. * Interrupt nesting. Some microcontrollers allow higher priority interrupts to interrupt lower priority ones. This allows software to manage latency by giving time-critical interrupts higher priority (and thus lower and more predictable latency) than less-critical ones. * Trigger rate. When interrupts occur back-to-back, microcontrollers may avoid an extra context save/restore cycle by a form of
tail call In computer science, a tail call is a subroutine call performed as the final action of a procedure. If the target of a tail is the same subroutine, the subroutine is said to be tail recursive, which is a special case of direct recursion. Tail recur ...
optimization. Lower end microcontrollers tend to support fewer interrupt latency controls than higher end ones.


Memory technology

Two different kinds of memory are commonly used with microcontrollers, a
non-volatile memory Non-volatile memory (NVM) or non-volatile storage is a type of computer memory that can retain stored information even after power is removed. In contrast, volatile memory needs constant power in order to retain data. Non-volatile memory typ ...
for storing firmware and a read–write memory for temporary data.


Data

From the earliest microcontrollers to today, six-transistor SRAM is almost always used as the read/write working memory, with a few more transistors per bit used in the
register file A register file is an array of processor registers in a central processing unit (CPU). The instruction set architecture of a CPU will almost always define a set of registers which are used to stage data between memory and the functional units on ...
. In addition to the SRAM, some microcontrollers also have internal EEPROM and/or
NVRAM Non-volatile random-access memory (NVRAM) is random-access memory that retains data without applied power. This is in contrast to dynamic random-access memory (DRAM) and static random-access memory (SRAM), which both maintain data only for as l ...
for data storage; and ones that do not have any (such as the
BASIC Stamp The BASIC Stamp is a microcontroller with a small, specialized BASIC interpreter ( PBASIC) built into ROM. It is made by Parallax, Inc. and has been popular with electronics hobbyists since the early 1990s. Technical specifications Although ...
), or where the internal memory is insufficient, are often connected to an external EEPROM or flash memory chip. A few microcontrollers beginning in 2003 have "self-programmable" flash memory.


Firmware

The earliest microcontrollers used mask ROM to store
firmware In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computer, computing machinery. It includes the study and experimentation of algorithmic processes, and the development of both computer hardware, h ...
. Later microcontrollers (such as the early versions of the Freescale 68HC11 and early
PIC microcontroller PIC (usually pronounced as /pɪk/) is a family of microcontrollers made by Microchip Technology, derived from the PIC1640 originally developed by General Instrument's Microelectronics Division. The name PIC initially referred to ''Peripher ...
s) had
EPROM An EPROM (rarely EROM), or erasable programmable read-only memory, is a type of programmable read-only memory (PROM) integrated circuit, chip that retains its data when its power supply is switched off. Computer memory that can retrieve stored d ...
memory, which used a translucent window to allow erasure via UV light, while production versions had no such window, being OTP (one-time-programmable). Firmware updates were equivalent to replacing the microcontroller itself, thus many products were not upgradeable. Motorola MC68HC805 was the first microcontroller to use
EEPROM EEPROM or E2PROM (electrically erasable programmable read-only memory) is a type of non-volatile memory. It is used in computers, usually integrated in microcontrollers such as smart cards and remote keyless systems, or as a separate chip d ...
to store the firmware. EEPROM microcontrollers became more popular in 1993 when Microchip introduced PIC16C84 and Atmel introduced an 8051-core microcontroller that was first one to use
NOR Flash memory Flash memory is an electronic non-volatile computer memory storage medium that can be electrically erased and reprogrammed. The two main types of flash memory, NOR flash and NAND flash, are named for the NOR and NAND logic gates. Both use ...
to store the firmware. Today's microcontrollers almost all use flash memory, with a few models using FRAM and some ultra-low-cost parts still using OTP or Mask ROM.


See also

*
Microprocessor A microprocessor is a computer processor (computing), processor for which the data processing logic and control is included on a single integrated circuit (IC), or a small number of ICs. The microprocessor contains the arithmetic, logic, a ...
*
System on a chip A system on a chip (SoC) is an integrated circuit that combines most or all key components of a computer or Electronics, electronic system onto a single microchip. Typically, an SoC includes a central processing unit (CPU) with computer memory, ...
* List of common microcontrollers * List of Wi-Fi microcontrollers *
List of open-source hardware projects This is a list of open-source hardware projects, including computer systems and components, cameras, radio, telephony, science education, machines and tools, robotics, renewable energy, home automation, medical and biotech, automotive, prototypi ...
* Microbotics *
Programmable logic controller A programmable logic controller (PLC) or programmable controller is an industrial computer that has been ruggedized and adapted for the control of manufacturing processes, such as assembly lines, machines, robotic devices, or any activity that ...
* Single-board microcontroller


References


External links

{{Authority control