A microcircuit designed to control electronic devices. Microcontrollers (Topic). a set of registers for storing intermediate data

28.07.2021 external HDs
Microcontroller memory organization
I/O ports
Timers-counters
Interrupts
Analog-to-digital converter
Communication Interfaces
  • Universal synchronous-asynchronous USART transceiver

Video course on programming STM32 microcontrollers

Microprocessor called a software-controlled device that carries out the processing process digital information and its management. The microprocessor is implemented as a large-scale integrated circuit (LSI) or ultra-large-scale integrated circuit (VLSI). The microprocessor acts as a processor in digital systems for various purposes.

The main feature of the microprocessor is the ability to program the operating logic.

Microcontroller (MCU)- a microcircuit designed to control electronic devices. A typical microcontroller combines the functions of a processor and peripheral devices, and may contain RAM and ROM. Essentially, it is a single-chip computer capable of performing simple tasks. Using a single chip, instead of a whole set, as is the case with conventional processors used in personal computers, significantly reduces the size, power consumption and cost of devices built on the basis of microcontrollers.

Microprocessor system (MPS) is a functionally complete product consisting of one or more devices, mainly microprocessor-based: a microprocessor and/or a microcontroller.

Microprocessor device (MPU) is a functionally and structurally complete product, consisting of several microcircuits, which include a microprocessor; it is designed to perform a specific set of functions: receiving, processing, transmitting, converting information and managing.

Main advantages of microprocessor systems compared with digital systems on "hard logic".

  • Multifunctionality: large quantity functions can be implemented on one element base.
  • Flexibility: the ability to correct and modify the microprocessor program to implement different operating modes of the system.
  • Compactness: miniature dimensions of microcircuits and a reduction in their number compared to implementation on “hard logic” make it possible to reduce the dimensions of devices.
  • Increased noise immunity: fewer connecting wires improve device reliability.
  • Performance: the ability to use higher operating frequencies and more complex information processing algorithms.
  • Information protection: the ability to protect the microprocessor program from being read allows you to protect the copyright of developers.

Although the microprocessor is a universal tool for digital information processing, certain areas of application require the implementation of certain specific options for their structure and architecture. Therefore, according to their functional characteristics, two classes are distinguished: microprocessors general purpose and specialized microprocessors. Among specialized microprocessors, the most widely used are microcontrollers designed to perform control functions for various objects, and digital signal processors (DSP - Digital Signal Processor), which are focused on implementing procedures that provide the necessary conversion of analog signals presented in digital form.

A partial list of peripherals that may be present in microcontrollers includes:

  • various input/output interfaces such as UART, I²C, SPI, CAN, USB, ETHERNET;
  • analog-to-digital and digital-to-analog converters;
  • comparators;
  • pulse width modulators;
  • timers-counters;
  • clock generator;
  • display and keyboard controllers;
  • arrays of built-in flash memory.

The idea of ​​placing a microprocessor and peripheral devices on one chip belongs to engineers M. Cochran and G. Boone, employees of Texas Instruments. The first microcontroller was the 4-bit TMS1000 from Texas Instruments, which contained RAM (32 bytes), ROM (1 kbyte), clock, and I/O support. Released in 1972, it had a new feature at that time - adding new instructions.

In 1976 (5 years after the creation of the first microprocessor), the first Intel microcontroller was born, named 8048. In addition to the central processor, the chip contained 1 kilobyte of program memory, 64 bytes of data memory, two eight-bit timers, a clock generator and 27 lines input/output ports. Microcontrollers of the 8048 family were used in Magnavox Odyssey game consoles, in the keyboards of the first IBM PC and in a number of other devices.

Today, among the major manufacturers of microcontrollers, Atmel, Microchip, ST Microelectronics, Texas Instruments, Freescale Semiconductor, NXP, etc. should be mentioned.

Microprocessor system(MPS) is a functionally complete product consisting of one or more devices, mainly microprocessor-based: a microprocessor or a microcontroller.

Microprocessor(MP) is a software-controlled device (“processor”) that performs arithmetic, logical operations, the process of digital information processing and control, on one large integrated circuit (LSI) or a set of several specialized chips.

Microcontroller(MK) is a microcircuit designed to control electronic devices. combines the functions of a processor and various peripheral devices on one chip, and contains RAM or ROM. Essentially, it is a single-chip computer capable of performing simple tasks.

microprocessor device(MPU), is a functionally and structurally complete product, consisting of several microcircuits, which include a microprocessor; it is designed to perform a specific set of functions: receiving, processing, transmitting, converting information and managing.

Based on their functionality, microprocessors are divided into general-purpose microprocessors and specialized microprocessors. The latter are divided into microcontrollers and digital signal processors (DSP). MCUs are available in 8-, 16- and 32-bit, and DSPs are available in fixed-point (16- and 24-bit) and floating-point (32-bit). A characteristic feature of the structure of microcontrollers is the placement of internal memory and a large set of peripheral devices on the same chip with the central processor.

Architecture processor is the complex of its hardware and software provided to the user. This general concept includes a set of software-accessible registers and executive (operating) devices, a system of basic commands and addressing methods, the volume and structure of addressable memory, types and methods of interrupt processing.

CISC– the architecture is implemented in many types of microprocessors that execute a large set of multi-format instructions using numerous addressing methods. RISC– the architecture is distinguished by the use of a limited set of commands of a fixed format. VLIW– this architecture appeared in the 1990s. Its peculiarity is the use of very long commands (up to 128 bits or more), the individual fields of which contain codes that enable the execution of various operations.

Princeton architecture(von Neumann), characterized by the use of a general random access memory for storing programs, data, and also for organizing a stack. To access this memory, a common system bus is used, through which both commands and data enter the processor. The presence of shared memory allows you to quickly redistribute its volume to store separate arrays of commands, data and stack implementation, depending on the tasks being solved. Harvard- physical separation of command memory (programs) and data memory. Its original version also used a separate stack. Each memory is connected to the processor by a separate bus, which allows simultaneous reading and writing of data while executing the current command to fetch and decode the next command. higher performance than using Princeton architecture.

Design of programs. a program is designed that satisfies the requirements of the problem statement. After the task as a whole has been set, the program design stage is performed, which is traditionally associated with drawing up a block diagram of the program, however, at the program development stage it is useful to use the following design methods:

Modular programming is a method in which long programs are broken down into shorter programs (modules).

Top-down programming is a method in which the problem being developed is divided into several generalized tasks, which are then detailed further. This process continues from top to bottom until the resulting subtasks are formulated in such a way that they can be simply implemented on a computer. Structured programming is a method in which programs are written according to specially developed rules (they use only certain types of program statements) and each program block has only one input and one output.

Good afternoon, dear radio amateurs!
Welcome to the website ““

Microcontrollers

Microcontroller (Micro Controller Unit, MCU) - microcircuit designed to control electronic devices(see Fig. 1a). A typical microcontroller combines the functions of a processor and peripheral devices, contains RAM(Random Access Memory) or ROM(Read Only Memory). Essentially, it is a small computer that can perform specific tasks.

The use of “powerful” in a modern microcontroller computing device with broad capabilities, built on a single chip instead of a whole set, significantly reduces the size, power consumption and cost of devices created on its basis. Microcontrollers can be found in almost any modern electronic device: mobile phones, photo and video cameras, calculators, watches, televisions, media players, computers, in industrial, automotive, military equipment and even in electric kettles.

Today there are a large number of microcontrollers different types. Popular with developers PiC microcontrollers Microchip Technology, as well as AVR and ARM Atmel Corporation. To make the microcontroller perform its tasks, it must be programmed using a specific program. It is usually attached to schematic diagram and is contained in a file with the extension .hex. More often this program is called “firmware”. Different firmware is written for different microcontrollers. Any firmware contains machine codes that are understandable to the microcontroller. But it is difficult for a person to remember the correspondence between control commands and machine codes. Therefore, the program is first written using some languageprogramming (Assembler, C), and then translated into machine codes of the controller using a translator program.

There is also special software for writing programs. For example, to develop AVR firmware they often use WinAVR, which has everything necessary tools: compiler (for C and C++ languages), programmer, debugger, editor, etc. WinAVR is widely used all over the world by both amateurs and professionals. To create firmware for PIC microcontrollers, you can use CCS PCWHD (PIC C Compiler) - a C language compiler. Just like the previous software, it contains everything necessary for programming microcontrollers.
In order to “flash” the microcontroller, you need a programmer (see Fig. 16). It is a software and hardware complex consisting directly of a device that connects the microcontroller to a computer and a program that controls this device. The programmer enters the program prepared for the microcontroller into its memory. You can buy a programmer or assemble it yourself.

There are separate programmers for various types microcontrollers, as well as universal ones that are capable of flashing most of these microcircuits. One of the disadvantages of the latest programmers is the high price.

Microcontroller is a special chip designed to control various electronic devices. Microcontrollers first appeared in the same year as general-purpose microprocessors (1971). Microcontroller developers came up with an ingenious idea - to combine the processor, memory, ROM and peripherals inside one package that looks like a regular microcircuit. Since then, the production of microcontrollers annually exceeds the production of processors many times, and the need for them has not decreased.

Microcontrollers are produced by dozens of companies, and they produce not only modern 32-bit microcontrollers, but also 16 and even 8-bit ones (like the i8051 and analogues). Within each family you can often find almost identical models, differing in CPU speed and memory capacity.

The fact is that microcontrollers are used primarily in embedded systems, in toys, in machine tools, in mass home appliances, in home automation - where it is not processor power that is needed, but rather a balance between price and sufficient functionality.

That is why the oldest types of microcontrollers are still in use - they can do a lot: from automatically opening doors and turning on lawn watering to integrating into the system " smart House" At the same time, there are more powerful microcontrollers that can perform hundreds of millions of operations per second and are tied to the teeth with peripherals. They have corresponding tasks. Thus, the developer first evaluates the task, and only then selects the appropriate hardware for it.

Today, there are more than 200 modifications of microcontrollers compatible with the i8051, produced by two dozen companies, and a large number of microcontrollers of other types. 8-bit ones are popular among developers. PIC microcontrollers from Microchip Technology and AVR from Atmel, 16-bit MSP430 from TI, as well as 32-bit microcontrollers, ARM architecture, which is developed by ARM Limited and sells licenses to other companies for their production.

A microcontroller is characterized by a large number of parameters, since it is simultaneously a complex software-controlled device and an electronic device (chip). The prefix “micro” in the name of the microcontroller means that it is implemented using microelectronic technology.

During operation, the microcontroller reads commands from memory or an input port and executes them. What each command means is determined by the microcontroller's command system. The command system is embedded in the microcontroller architecture and the execution of the command code is expressed in the internal elements of the microcircuit performing certain micro-operations.

Microcontrollers allow you to flexibly control various electronic and electrical devices. Some microcontroller models are so powerful that they can directly switch relays (for example, on Christmas tree lights).

Microcontrollers, as a rule, do not work alone, but are soldered into a circuit, where, in addition to it, screens, keyboard inputs, various sensors etc.

Software for microcontrollers may attract the attention of those who love to “chase bits”, since the memory in microcontrollers usually ranges from 2 to 128 KB. If less, then you have to write in assembler or Forte; if possible, then use special versions of BASIC, Pascal, but mostly C. Before the microcontroller is finally programmed, it is tested in emulators - software or hardware.

A MICROCONTROLLER is no longer a processor, but also not a computer.

The central processor found in every computer is the main computer. Although a computer is not designed solely for computing workloads, the processor is the main element in it. But not only the computer has a processor.

If you think about it and take a closer look, you will find that processors are used in most household appliances. Only they use not the same processors as in a computer, but microprocessors and even microcontrollers.

So what is a microcontroller and how does it differ from the processor itself or are they completely different? electronic components?

Large integrated circuits or highly integrated circuits are processors. Microprocessors are essentially the same processors, but because of the prefix “micro” their essence is determined that they are smaller than their “large” counterparts. In its historical time, a processor with its size could occupy more than one room; it’s fitting to call them, like extinct dinosaurs, macro-processors, in order to somehow streamline them in the modern concept of electronics.

A smaller and packaged processor takes up less space and can be placed in a more compact product; this is a microprocessor. But the processor itself is not capable of doing much other than transferring data between registers and performing some arithmetic and logical operations on them.

In order for the microprocessor to be able to send data to memory, this memory must be present either on the chip itself, on which the processing element itself is located, or connected to external RAM made in the form of a separate chip or module.

In addition to memory, the processor must interact with external devices- periphery. Otherwise, what benefit can you expect from the work of the processor, mixing and moving data back and forth? The meaning comes when the processor interacts with I/O devices. For a computer, this is a keyboard, a mouse and display devices such as a display, optionally a printer and, for example, a scanner, again for entering information.

To control I/O devices, appropriate buffer circuits and elements are required. On their basis, interface so-called hardware is implemented. Methods of interaction with interface elements require the presence of I/O port circuits, address decoders and bus drivers with buffer circuits to increase the load capacity of the microprocessor.

The integration of the processor with all the necessary additional elements in order for this product to result in some kind of complete design leads to the formation of a microcontroller. A microcircuit or microcontroller chip implements a processor and interface circuits on a single chip.

A self-sufficient chip that contains almost everything so that it is enough to build a finished product is an example of a typical microcontroller. For example wrist Digital Watch or an alarm clock has a microcontroller inside that implements all the functions of such a device. Separate peripherals are connected directly to the legs of the microcontroller chip, or additional elements or microcircuits of low or medium degree of integration are used together.

Microcontrollers are widely used in products that contain the entire system solely in one miniature chip, often called a microassembly. For example, a “chip” credit card contains a microcontroller inside in a plastic base. The intercom tablet also contains a microcontroller inside itself. And examples of the use and application of microcontrollers are so extensive in modern world, that it is easy to detect the presence of a controller in any more or less intelligent device, from a children's toy to a wireless headset for a cell phone.

Microcontroller is a special chip designed to control various electronic devices. Microcontrollers first appeared in the same year as general-purpose microprocessors (1971).

Microcontroller developers came up with an ingenious idea - to combine the processor, memory, ROM and peripherals inside one package that looks like a regular microcircuit. Since then, the production of microcontrollers annually exceeds the production of processors many times, and the need for them has not decreased.

Microcontrollers are produced by dozens of companies, and they produce not only modern 32-bit microcontrollers, but also 16 and even 8-bit ones (like the i8051 and analogues). Within each family you can often find almost identical models, differing in CPU speed and memory capacity.

Microcontrollers, as a rule, do not work alone, but are soldered into a circuit where, in addition to it, screens, keyboard inputs, various sensors, etc. are connected.

Software for microcontrollers may attract the attention of those who love to “chase bits”, since the memory in microcontrollers usually ranges from 2 to 128 KB. If less, then you have to write in assembler or Forte; if possible, then use special versions of BASIC, Pascal, but mostly C. Before the microcontroller is finally programmed, it is tested in emulators - software or hardware.

Here the question may arise: a microprocessor and a microcontroller are simple different name the same device, or are they still different things?

A microprocessor is the central device of any computer, made using integrated technology. The name itself suggests that it is in it that computational processes take place. In order for it to become a computer, even if it is not a very modern and powerful one (remember the amateur designs of Radio-86 or Sinclair), it must be supplemented with external devices. First of all, this is RAM and input/output ports.

The microcontroller contains a processor, RAM, program memory, and in addition a whole set of peripheral devices that turn the processor into a fully functional computer. According to the old terminology of Soviet times, such devices were called Single-chip Microcomputers. But Soviet computing technology, as we know, has reached a dead end, and with it the OMEVM.

Foreign computing technology did not stand still, so OMEVMs began to be called controllers (from the English Control - to manage, control). And in fact, the controllers turned out to be very suitable for controlling various equipment, even not very complex ones.

A MICROCONTROLLER is no longer a processor, but also not a computer.

The central processor found in every computer is the main computer. Although a computer is not designed solely for computing workloads, the processor is the main element in it. But not only the computer has a processor.

If you think about it and take a closer look, you will find that processors are used in most household appliances. Only they use not the same processors as in a computer, but microprocessors and even microcontrollers.

So what is a microcontroller and how does it differ from the processor itself, or are they completely different electronic components?

Large integrated circuits or highly integrated circuits are processors. Microprocessors are essentially the same processors, but because of the prefix “micro” their essence is determined that they are smaller than their “large” counterparts. In its historical time, a processor with its size could occupy more than one room; it’s fitting to call them, like extinct dinosaurs, macro-processors, in order to somehow streamline them in the modern concept of electronics.

A smaller and packaged processor takes up less space and can be placed in a more compact product; this is a microprocessor. But the processor itself is not capable of doing much other than transferring data between registers and performing some arithmetic and logical operations on them.

In order for the microprocessor to be able to send data to memory, this memory must be present either on the chip itself, on which the processing element itself is located, or connected to external RAM made in the form of a separate chip or module.

In addition to memory, the processor must interact with external devices - peripherals. Otherwise, what benefit can you expect from the work of the processor, mixing and moving data back and forth? The meaning comes when the processor interacts with I/O devices. For a computer, this is a keyboard, a mouse and display devices such as a display, optionally a printer and, for example, a scanner, again for entering information.

To control I/O devices, appropriate buffer circuits and elements are required. On their basis, interface so-called hardware is implemented. Methods of interaction with interface elements require the presence of I/O port circuits, address decoders and bus drivers with buffer circuits to increase the load capacity of the microprocessor.

The integration of the processor with all the necessary additional elements in order for this product to result in some kind of complete design leads to the formation of a microcontroller. A microcircuit or microcontroller chip implements a processor and interface circuits on a single chip.

A self-sufficient chip that contains almost everything so that it is enough to build a finished product is an example of a typical microcontroller. For example, an electronic wristwatch or alarm clock has a microcontroller inside that implements all the functions of such a device. Individual peripheral devices are connected directly to the pins of the microcontroller chip, or additional elements or microcircuits of low or medium integration are used together.

Microcontrollers are widely used in products that contain the entire system solely in one miniature chip, often called a microassembly. For example, a “chip” credit card contains a microcontroller inside in a plastic base. It also contains a microcontroller inside. And the examples of the use and application of microcontrollers are so extensive in the modern world that it is easy to detect the presence of a controller in any more or less intelligent device, from a children's toy to a wireless headset for a cell phone.

See also on our website:

See also Maxim Selivanov’s educational video courses on this topic:

Kur for those who are already familiar with the basics of electronics and programming, who know basic electronic components, assemble simple circuits, knows how to hold a soldering iron and wants to switch to high-quality new level, but constantly postpones this transition due to difficulties in mastering new material.

The course is also great for those who have only recently made their first attempts to learn microcontroller programming, but are already ready to give up because nothing works for them or works, but not the way they need (sound familiar?!).

The course will also be useful for those who are already assembling simple (or maybe not so simple) circuits on microcontrollers, but do not understand well the essence of how a microcontroller works and how it interacts with external devices.

The course is dedicated to teaching microcontroller programming in C language. Distinctive feature course - learning the language at a very deep level. Training takes place using the example of AVR microcontrollers. But, in principle, it is also suitable for those who use other microcontrollers.

The course is designed for trained students. That is, the course does not cover the basic fundamentals of computer science and electronics and microcontrollers. But, in order to master the course, you will need minimal knowledge of programming AVR microcontrollers in any language. Knowledge of electronics is desirable, but not required.

The course is ideal for those who have just started learning programming. AVR microcontrollers in the C language and wants to deepen his knowledge. It is also good for those who have a little knowledge of programming microcontrollers in other languages. It is also suitable for ordinary programmers who want to deepen their knowledge of the C language.

This course is for those who do not want to limit their development to simple or ready-made examples. The course is perfect for those who are interested in creating interesting devices with a full understanding of how they work. The course is well suited for those who are already familiar with programming microcontrollers in the C language and for those who have been programming them for a long time.

The course material is primarily focused on practical use. The following topics are covered: radio frequency identification, audio reproduction, wireless data exchange, working with color TFT displays, touch screen, working with file FAT system SD cards.