Microcontroller

from Wikipedia, the free encyclopedia

As a microcontroller (also microontroller, .mu.C, MCU) are semiconductor chips referred to, having a processor and at the same time and peripheral functions included. In many cases, the work and program memory are partly or completely on the same chip. A microcontroller is a one-chip computer system . The term system-on-a-chip or SoC is also used for some microcontrollers .

Complex peripheral functions such as: B. CAN - (Controller Area Network), LIN - (Local Interconnect Network), USB - (Universal Serial Bus), I²C - (Inter-Integrated Circuit), SPI - (Serial Peripheral Interface), serial or Ethernet interfaces, PWM Outputs, LCD controllers and drivers as well as analog-digital converters . Some microcontrollers also have programmable digital and / or analog or hybrid function blocks.

Microcontroller in ceramic housing with quartz glass window

Areas of application

The microcontroller often occurs in everyday life in the form of embedded systems in technical consumer goods, for example in washing machines, chip cards ( money , telephone cards ), entertainment electronics ( video recorders , CD / DVD players , radios , televisions , remote controls ), office electronics, Segways, motor vehicles ( control units for e.g. ABS , airbags , engines , instrument clusters , ESP , etc.), cell phones and even in clocks and watches . In addition, they are contained in practically all computer peripheral devices ( keyboard , mouse , printer , monitor , scanner and much more).

Microcontrollers are adapted in performance and equipment to the respective application. Therefore, they have advantages over “normal” computers in terms of costs and power consumption. Small microcontrollers are available in higher numbers for a few cents.

Differentiation from microprocessors

Rockwell R6511 microcontroller based on the 6502

The boundary between microcontrollers and microprocessors is fluid, which is also reflected in the fact that, after some time, microcontroller variants of a new microprocessor architecture have often appeared. In the simplest case, this is done by integrating the components implemented as support and peripheral modules in a classic microprocessor, such as clock and reset generation, interrupt controllers, timers, interface modules and, in some cases, memory controllers, into the chip itself, so that a functional processor system often only a quartz (for the clock) and memory modules are necessary. Typical representatives of this genus are z. B. the Intel 80186 ( derived from the 8086 ), the XScale family ( ARM ) and ColdFire ( MC680xx ) from Freescale (formerly Motorola). These controller series are often continued even after the mainstream CPU concerned has long ceased to be produced (e.g. 6502, MC680xx).

In some cases, microcontrollers are also used as part of a Multi Chip Module (MCM). This usually happens when different semiconductor processes are to be combined that are difficult or impossible to combine on one chip. Examples of this are combinations of microcontrollers with high-frequency circuits for radio connections (e.g. Atmel, Cypress, Microchip manufacture such MCMs), with power electronics (e.g. Freescale, ST) or with Flash ROM in its early days (e.g. Micronas Intermetall ). The solution with an MCM is sometimes also used when existing chips are to be combined with one another, but the effort for a new design is to be avoided. Examples of this are combinations with network controllers or the connection drivers for networks (PHY) or LCD controllers.

On the other hand, there are also “classic” microcontroller architectures that were not intended as a pure microprocessor system from the start, but were primarily aimed at control tasks. These are characterized e.g. B. in that a single-chip operation is possible with them completely without external memory modules, just like the instruction set of the CPU mostly offers specialized commands for controlling individual signal lines (by means of so-called bit manipulations). It is also important for such controllers to have the shortest possible interrupt latency, i.e. the time that the controller needs to respond to the interrupt request from a signal source (timer, peripheral module, etc.). Typical representatives of this genus are z. B. the 8051 from Intel as well as the C166 from Siemens (today Infineon) and Infineon TriCore . So-called watchdog circuits are generally used to monitor the functioning of microcontroller controls, some of which are already integrated into the microcontroller.

This separation took place with the Intel 8085 - afterwards there were the pure data processors (microprocessor; e.g. 8086 family ) and the data translators (microcontroller; e.g. 8048 , 8051 ) as the interface between the hardware and the central microprocessor. Microcontrollers can also have a passive bus interface (e.g. 8041A , a variant of the 8048) - from the point of view of the microprocessor like a peripheral chip. Whether TV, VHS recorder, X-ray machine, car or PC, today there is a division of labor between these two types. With the introduction of buses (K-Bus, CAN-Bus , LIN , FlexRay ) the central processor can concentrate completely on the evaluation of the message (telegram) - e.g. B. "Handbrake_On button pressed". Only the responsible controller knows the event in the hardware or on a subordinate bus that led to this message. If the processor now sends a message, e.g. B. "Release handbrake", the controller will activate the hardware accordingly or inform the subordinate bus. However, today's controllers are already so computationally powerful that they can often do without a superordinate microprocessor and can handle all tasks completely themselves.

Architectures

The number of built-in microcontrollers far exceeds the number of microprocessors. The vast majority of the microcontrollers used are based on 8-bit processors , some of whose basic architecture dates back to the first half of the 1970s. However, there are also 4, 16, and 32-bit microcontrollers. In terms of quantity, the 4-bit microcontrollers are still well represented, as they are cheap to produce due to their simple structure and are used for simple tasks, such as. B. clocks suffice.

8- and 16-bit microcontrollers are meanwhile losing market share to 32-bit microcontrollers. The reason is that in modern semiconductor processors between 8 and 16 and 32 bits there is no longer a very large difference in the manufacturing effort, but the advantage of the simpler memory management of the 32-bit microcontroller and the simpler programming that this brings is considerable. However, 8- and 16-bit microcontrollers require fewer transistors, which means that, provided they are based on a modern processor design with energy-saving mechanisms, they are usually more economical than 32-bit microcontrollers.

Many of the microcontrollers in use today are based on processor cores that were previously used as microprocessors. With the 8- and 16-bit microcontrollers, the microprocessors are now mostly no longer manufactured. But there are also microcontroller cores that were not manufactured as microprocessors, such as Atmel AVR , PIC microcontrollers , Silicon Labs EFM8 or EFM32 , TI MSP430 , Infineon TriCore , XMC4000 , XMC1000 , XE166 , XC800 , Aurix and others.

Program memory used

Different variants of the MC68HC05J family. From left: MC68HC705JJ7 with EPROM, MC68HC705J1A with PROM, MC68HC05J1A with mask ROM release pattern, MC68HC05J1A with mask ROM production version
Temporary interim solution (
piggyback ) with external EPROM (above) on a permanently integrated base and integrated interface logic .

The types of memory used in microcontrollers have changed over the years and partly depend on the architecture and economic considerations. In the early days of the microcontroller, and even today with 4-bit architectures, there were almost exclusively ROM memories. Software for such microcontrollers must be created with appropriate development systems that allow a simulation of the microcontroller and usually have an in-circuit emulator . The software created in this way is then sent to the manufacturer of the microcontroller, who then provides the chips with this software during the manufacturing process. This usually happens when the last metal layer is applied to the chip (the last “mask”, hence also “ mask-programmed microcontroller”).

The disadvantage of this method is the lack of flexibility, since there is a delay of several weeks or even months when the software is changed. This technology cannot be used for smaller projects, as most manufacturers provide for minimum order quantities of 20,000 chips. In addition, the error rate is high, since the software could not be tested on the final chip, but only with the help of the development system. On the other hand, there is the cheaper price of the chips, because the manufacturing process for ROM memories is somewhat simpler than that for programmable memories and of course the elimination of programming as a manufacturing step. For this reason, versions with ROM memory are still used today almost exclusively for products with very large quantities and thus low unit prices.

To simplify the development process and enable projects with small numbers of pieces, microcontrollers using EPROMs (Erasable Programmable Read Only Memory) appeared on the market in the second half of the 1970s . With these microcontrollers, the program memory could be written with a suitable programming device and then erased again with UV light. This provided a much cheaper development tool that also allowed a very practical test. In addition, it also made projects with smaller numbers possible. Due to the elaborate ceramic housing with an embedded quartz window for erasing the EPROM memory, however, these chips were significantly more expensive than the ROM versions.

Due to the increasing use of EPROM-based microcontrollers, chips became available in the 1980s that were mounted in a plastic housing without a window, i.e. after programming, they could no longer be erased by UV light. These microcontrollers, also called OTP (One Time Programmable), are relatively close to the ROM versions in terms of price. The greater flexibility and the elimination of start-up costs (for ROM versions, the manufacturer calculates the tool costs incurred once for each new software version) means that these OTP chips are used in numerous circuits even with larger quantities.

In the meantime, flash memory dominates as program memory for new microcontrollers and smaller quantities or in the development phase . Since this can be electrically erased and rewritten directly, the complex ceramic housing is no longer necessary and the memory can be completely tested during the manufacturing process. The cost advantage of the ROM version is still effective for really large quantities.

The microcontrollers used today are a mixture of these technologies. On the one hand, the requirements of the respective application are a factor (ROM can, for example, be the only sufficiently stable memory in the case of extreme temperature requirements, EPROM still has advantages over Flash here), on the other hand, many of the microcontrollers have been on the market for a long time.

Typical memory sizes of today's microcontrollers are between 1 kByte and 2 MB for the program and between 32 bytes and 48 kByte for the data. The mentioned RAM is meant internally, while internal as well as external solutions exist for the ROM part. However, many models can also address much larger external storage.

programming

PIC 18F8720 microcontroller in an 80-pin TQFP package

Microcontrollers are mostly programmed in the programming languages ​​assembler , C or C ++ . Other languages ​​such as BASIC , Pascal , Forth or Ada are also used. In the hobby area, specific, specially designed languages ​​(such as JAL for the PICmicro family from Microchip Technology ) have become established for certain types of microcontrollers . For some time now , microcontrollers have also been offered that can be easily programmed with Lua ( e.g. NodeMCU ) or MicroPython .

As with the program memories, the programming language used also depends on the architecture, application goal and requirements. For 4-bit architectures, assembler is used almost exclusively, since only very few compilers can effectively use the scarce resources of these smallest microcontrollers. Assembler is also often used in 8-bit architectures in order to achieve the highest possible efficiency and code density; In projects that use comparatively little of the available μC resources or are produced in smaller quantities, it is increasingly common to use high-level languages ​​in order to save development effort. 16- and 32-bit architectures are mainly programmed in high-level languages.

The high-level language most frequently used for microcontrollers is C, as programming that is very close to the hardware is also possible here. Forth had a certain importance in the 1980s as it allowed a very compact and fast code. However, it has a syntax that takes getting used to and is therefore now more of a shadowy existence. Other high-level languages ​​for programming mainstream applications generally have relatively little significance for the programming of microcontrollers, while the Ada programming language is primarily used in military applications and other security-critical areas with high demands on the security and runtime behavior of software (such as avionics in Aircraft / spacecraft). A newer language, the development of which is being closely followed by some in this area, is Rust .

Development tools that allow the purely graphic design of software for microcontrollers are relatively new. LabVIEW from National Instruments allows the generation of executable code for some controllers and Cypress has been pursuing the goal of at least the implementation of simpler control applications with the PSoC microcontrollers without programming knowledge with the PSoCexpress tool for some time .

Some microcontrollers that have a high-level language interpreter in the chip are special. The first building blocks of this genus included u. a. a derivative of the 8052 with the designation 8052AH, which was delivered as 8052AH-BASIC with a BASIC interpreter in 8 kByte ROM, and the Rockwell R65F11 / R65F12 based on the 6502 processor, which had a Forth interpreter in the internal ROM. Any computer with a serial interface and a terminal program is sufficient for programming such a solution; there is no need to purchase a separate (often expensive) high-level language compiler.

Similar products are now also offered by other manufacturers based on conventional microcontrollers, but no such products are currently known directly from chip manufacturers. Microcontroller modules that can be programmed in Basic or Forth are very popular with both hobbyists and professional users with small quantities (e.g. in test equipment construction and for laboratory tests) because of their easy handling.

See also

literature

  • Practical course programming AVR microcontrollers in C , Franzis Verlag, 2011, ISBN 978-3-645-65071-7
  • Klaus Wüst: Microprocessor Technology: Fundamentals, Architectures and Programming of Microprocessors, Microcontrollers and Signal Processors , Vieweg and Teubner, 2008, ISBN 978-3-8348-0461-7
  • Andreas Roth: Das Microcontroller Kochbuch MCS51 , mitp Verlag, 6th edition, January 2002, ISBN 978-3-8266-0722-6
  • Andreas Roth: Das Mikrocontroller-Application-Kochbuch , mitp Verlag, 2nd edition, January 1998, ISBN 978-3-8266-2822-1

Web links

Wiktionary: microcontroller  - explanations of meanings, word origins, synonyms, translations
Commons : Microcontrollers  - collection of images, videos and audio files

Individual evidence

  1. MicroPython - Python for microcontrollers . In: micropython.org .
  2. Michael Barr and Anthony Massa: Programming Embedded Systems. 2nd edition, O'Reilly Sebastopol, CA 2007, ISBN 0-596-00983-6 . P. 38