What does a microcontroller consist of? What are microcontrollers - purpose, device, software

In this article of the second issue of the Electron magazine, I want to touch on a very interesting topic regarding digital electronics. Today I want to answer a question what is a microcontroller.

So, the microcontroller is a small microcircuit, on the crystal of which a real microcomputer is assembled! This means that a processor, memory (ROM and RAM), peripheral devices were mounted inside one microcircuit, made them work and interact with each other and the outside world using a special microprogram that is stored inside the microcontroller.

The main purpose of microcontrollers is to control various electronic devices. Thus, they are used not only in personal computers, but in almost all household appliances, cars, televisions, industrial robots, even military radars.

We can say that the microcontroller is a universal tool for controlling electronic devices, and you put the control algorithm into it yourself and can change it at any time depending on the task assigned to the microcontroller.

This is what modern microcontrollers look like.

Currently, there are many different platforms and families of microcontrollers, but the purpose, application and essence of their functioning is almost the same.

We said that the microcontroller is a kind of microcomputer (the old name is single-chip microcomputers). Imagine it as a black box. Inside this box are the main structural elements of the microcontroller.

Arithmetic logic unit(ALU) - designed to perform arithmetic and logical operations, in fact, in conjunction with general-purpose registers, the ALU performs the functions of a processor.

Operational storage device(RAM) - designed for temporary data storage during the operation of the microcontroller.

Program memory- made in the form of a reprogrammable read-only memory device and is intended for recording the microcontroller control firmware, the so-called firmware.

Data memory used in some microcontrollers as a memory for storing all possible constants, table values ​​of functions, etc.

The microcontroller may include other auxiliary elements.

analog comparator– designed to compare two analog signals at its inputs

Timers in microcontrollers are used to implement various delays and set various time intervals in the operation of the microcontroller.

Analog to digital converter(ADC) is needed to input an analog signal to the microcontroller and its function is to convert the analog signal to digital.

D/A Converter(DAC) performs the opposite function, that is, it converts the signal from a digital form to an analog form.

The operation of the microcontroller is synchronized by clock pulses from the generator and is controlled by the microcontroller control device.

Thus, a microcontroller is an electronic kit with which you can assemble your own control device. By programming the microcontroller, you disable or connect component devices inside the microcontroller, and set your own algorithms for the operation of these devices.

I suggest you watch a video in which I explain what a microcontroller is and give a couple of examples of the practical application of microcontrollers.

By the way, for those who are interested in the topic and want to create their own device based on Atmel microcontrollers, I suggest watching the following video.

Video dedicated Atmel microcontroller programming video course , after passing which you will not only get acquainted with the wonderful world of microcontrollers, but also learn how to program microcontrollers, and therefore independently create electronic devices on microcontrollers.

Video course "Programming microcontrollers for beginners" more than 70 hours of high-quality video.

As a result of the study, you will gain the knowledge with which you can independently develop a device of any complexity.

Today, microcontrollers can be found in almost every instance of household appliances and electronics. For example, if a microwave oven has an LED or LCD screen and a keyboard, then it is necessarily equipped with a special control chip.

Variety of applications

All modern cars contain at least one microcontroller and may be equipped with several for the engine, anti-lock system, cruise control, etc. Any device with a remote control almost certainly has microcontroller control. TVs, players and high-quality stereo systems fall into this category. Digital compact and SLR cameras, cellular phones, camcorders, answering machines, laser printers, landline phones with caller ID capability and 20-number memory, multifunctional refrigerators, dishwashers and washing machines In principle, any household appliance or device that interacts with the user has built-in microcontroller.

What it is?

A microcontroller is a computer. All computers, whether personal computers or large mainframes, share some common features. They have which executes programs by loading commands from some kind of data store. On a PC, for example, this is the hard drive. The computer is also equipped with random access memory (RAM). For communication with the outside world, special means should be provided. On a PC, the keyboard and mouse are input devices, while the monitor and printer are used to output information. A hard drive combines both of these features because it works with both input and output data.

CPU

The type of processor used in the microcontroller depends on the specific application. Available options range from simple 4-, 8-, or 16-bit to more complex 32- or 64-bit. With regard to memory, RAM, flash memory, EPROM or EEPROM can be used. Typically, microcontrollers are designed to be used without additional computing components because they are designed with sufficient on-board memory and also have common I/O pins to interface directly with sensors and other components.

The architecture of the CPU can be either Harvard or Von Neumann, offering various methods for exchanging information between the processor and memory. In the first case, the data and command buses are separated, which allows their simultaneous transmission. In for this, the general is used.

Programming

Microcontroller processors can be based on an extended instruction set (CISC) or a reduced instruction set (RISC). CISC usually includes about 80 instructions (RISC - about 30), as well as a larger number of addressing modes - 12-24 compared to 3-5 for RISC. Although the extended instruction set is easier to implement and uses memory more efficiently, its performance is lower due to the higher number of clock cycles required to execute them. RISC processors pay more attention to software and are more productive.

The original language of microcontrollers was assembler. C is the popular language today.

With the appropriate cable, software and PC, it is not difficult to program the microcontroller with your own hands. It is necessary to connect the controller with a cable to the computer, run the application and load the command set.

Defining characteristics

How to distinguish a computer from a microcontroller? If the first is a general purpose device that can run thousands of different programs, then the second is specialized, focused on a single application. There are a number of other characteristics that distinguish microcontrollers. For novice users, this will not be a problem - it is enough to establish that the chip has most of the following qualities so that it can be safely attributed to this category.

  • Microcontrollers are elements of some other device (often household appliances) for controlling its functions or operation. They are also called embedded controllers.
  • The device is designed to perform one task and run one specific program stored in ROM, which usually does not change.

  • Microcontrollers are low power chips. Their power when powered from a battery is about 50 mW. A desktop computer is almost always connected to a power outlet and consumes 50 watts or more.
  • The microcontroller is distinguished by having a dedicated input block and often (but not always) a small LED or LCD for output. It accepts input from the device it controls, sending signals to its various components. For example, a TV microcontroller receives signals from the remote control and displays the output on the TV screen. It controls the channel selector, speakers, and some picture settings such as contrast and brightness. The automotive engine controller receives input from the oxygen and knock sensors, regulates the fuel mixture, and synchronizes the spark plugs. In a microwave oven, it accepts input from the keyboard, displays the output on the LCD, and controls the relay to turn on and off the microwave generator.
  • Microcontrollers are often small and inexpensive devices. Components are selected in such a way as to minimize the size and reduce the cost of production as much as possible.
  • Often, but not always, the microcontroller operates under adverse conditions. For example, a car's engine control device must operate in extreme temperatures where a conventional computer cannot function at all. In the north, the vehicle's microcontroller must operate at -34°C, and in the south at 49°C. The temperature in the engine compartment can reach 65-80 °C. On the other hand, the microcontroller built into the Blu-ray player doesn't need to be particularly rugged at all.

CPU Requirements

The processors used in microcontrollers can vary greatly. For example, cell phones used the 8-bit Z-80 microprocessor, developed in the 1970s and originally used in home computers. The Garmin GPS navigator was equipped with a low-power version of the Intel 80386, which was also originally installed in desktop PCs.

Most household appliances, such as microwave ovens, don't require processors, but their price is an important factor. In these cases, manufacturers turn to specialized microcontrollers designed from inexpensive, small, and low-power CPUs. Motorola 6811 and Intel 8051 are good examples of such chips. A series of popular Microchip companies is also produced. These processors are incredibly minimalist by today's standards, but they are extremely cheap and can often satisfy a designer's needs.

Economy

A typical microcontroller is a chip with 1000 bytes of ROM, 20 bytes of RAM, and 8 I/O pins. When produced in large quantities, their cost is low. Of course, it is impossible to run Microsoft Word on such a chip - this will require at least 30 MB of RAM and a processor that performs millions of operations per second. But this is not necessary to control the microwave oven. The microcontroller performs one specific task, and low cost and power consumption are its main advantages.

How does it work?

Despite the wide variety of microcontrollers and even more programs for them, having learned how to handle one of them, you can get to know everyone. A typical work scenario looks like this:

  • When the power is off, the device does not manifest itself in any way.
  • Connecting the microcontroller to a power source starts the control system logic block, which disables all other circuits except for the quartz crystal.
  • When the voltage reaches its maximum, the oscillator frequency stabilizes. Registers are filled with bits reflecting the state of all microcontroller circuits. All contacts are configured as inputs. Electronics starts to work according to the rhythmic sequence of clock pulses.
  • The command counter is reset. The instruction at this address is sent to the instruction decoder, which recognizes it, after which it is immediately executed.
  • The program counter is incremented by 1 and the entire process is repeated at a rate of one million operations per second.

To work with microcontrollers, such as Arduino or Iskra JS and the like, we need additional knowledge, which we will gradually learn.

Today I would like to write about microcontrollers in general, in order to improve my knowledge and at the same time tell others.

A microcontroller is a microcircuit that is used to control electronic devices. In a typical microcontroller, there are functions and processor, and peripheral devices, and also contains RAM and/or ROM(permanent storage device). In short, a microcontroller is a computer operating on a single chip that is capable of performing relatively simple operations.

Microcontrollers are widely used in computing (processors, motherboards, disk drive controllers, HDD / FDD drives), consumer electronics (washing machines, microwave ovens, telephones, etc.), in industry, etc. Consider how the microcontroller is connected and controlled, as well as other nuances associated with them.

Connecting the microcontroller

The diagram below is a simplified version of connecting the AVR microcontroller. AVR is a family of 8-bit microcontrollers from Atmel. Year of development - 1996.

In a good way, you need to add a few more additional external elements to the circuit.


The wire, which is indicated in the diagram by a dotted line, is not necessary to use if the microcontroller is powered from an external source.

Conclusion AREF used as an input for the reference voltage of the ADC - a voltage is supplied here, relative to which the ADC will be calculated. It is acceptable to use an internal 2.56V reference voltage source, or use the voltage from AVCC.

ADC (Analog to Digital Converter) - an electronic device that converts voltage into a binary digital code

It is recommended to connect a capacitor to the AREF pin, which will increase the quality of the ADC voltage and thus allow correct measurements of the ADC. A capacitor and a choke are installed between AVCC and GND, and a 100 nF ceramic capacitor is installed between GND and VCC (closer to the power pins of the circuit) to smooth out brief noise pulses resulting from the operation of the microcircuit.

Also, another 47 uF capacitor is installed between GND and VCC in order to smooth out possible voltage surges.

microcontroller control

AVR microcontrollers equipped with Harvard architecture. Each of the memory areas is located in its address space. Data memory in the controllers is carried out by means of register, non-volatile and random access memory.


Register memory provides for the presence of 32 general-purpose registers, which are combined into a file, as well as service registers for input and output. Both the first and the second are located in the RAM space, but are not part of it.

AT RVV areas(input and output registers) there are various service registers - status, microcontroller control, etc., as well as registers that are responsible for controlling peripheral devices that are part of the microcontroller. In fact, the management of these registers is the microcontroller control method.

Devices on microcontrollers

AVR microcontrollers are easy to use, have low power consumption and a high level of integration.

As a rule, such microcontrollers can be used on a wide variety of devices, including general purpose systems, public address systems, LCD displays, boards with limited space.

They are also used for battery level meters, authentication, automotive electronics, short circuit and overheating protection, etc. In addition to industrial purposes, microcontrollers can be used (and most often used by beginners) to create the following devices:

  • Temperature recorder on Atmega168;
  • Kitchen timer on Attiny2313;
  • Thermometer;
  • Industrial network frequency meter at 50 Hz;
  • LED brake light controller on Attiny2313;
  • LED lamps and fixtures that respond to temperature or sound;
  • Electronic or touch switches.

Note that different models of microcontrollers are used for different devices. So, 32-bit AVR UC3 microcontrollers (as well as XMEGA, megaAVR, tinyAVR, etc.) are suitable for general-purpose systems with picoPower, QTouch, EEPROM technologies, event processing systems and self-programming.

Microcontrollers for beginners

If you are going to program microcontrollers, such as Arduino, for example, and also assemble devices that provide for their presence in the circuit, you need to consider some rules and guidelines:

  • Before solving any problems, you should divide them into smaller ones, up to basic actions.
  • You should not use code generators and other "simplifying" materials, at least at the initial stages.
  • It is recommended to learn the C language and Assembler - this will simplify the understanding of the principle of operation of microcontrollers and programs.

In order for a beginner to be able to deal with microcontrollers, it is recommended to study the basic materials. These books include the following: "Using AVR microcontrollers: circuits, programs and algorithms" Baranov V.N., 2006, "AVR microcontrollers: an introductory course", J. Morton, 2008, "Programming ATMEL microcontrollers in C" Prokopenko V.S., 2012.

These books are a practical guide that covers aspects and fundamentals of digital logic, as well as examples of programs for microcontrollers written in C language with various circuit simulators, compilers and environments.

microcontroller is an integrated circuit designed to control various electronic devices or their individual functional blocks. Most microcontrollers combine the functions of a processor and peripheral (matching) devices. It contains a built-in non-volatile memory, which stores the algorithm (program) of its operation. At its core, a microcontroller is a small computer designed to perform simple tasks.

The first idea to create a microcontroller in 1971 was put forward by employees of the American electronic company Texas Instruments. It was they who proposed to assemble a small computer on one chip, placing a processor, memory and input / output devices there. After 5 years, this idea was picked up by the ubiquitous Intel, releasing the first i8048 microcontroller.

The basis of the microcontroller is the so-called arithmetic logic unit. In simpler terms, this is a kind of computational module that processes a program stored in memory. The program is usually written in the simplest language (machine code language) and can be rewritten for any functionality. It is rare that the program is hard-coded in the microcircuit and cannot be changed. This mainly applies to narrowly focused microcontrollers, which are manufactured specifically to control some simple devices, such as electric motors.

Non-volatile memory is usually located inside the controller and is designed to store the program. Some controllers, due to sufficiently capacious internal memory, do not have contacts for connecting an external storage device at all. Internal memory is very often divided into two parts: program memory and data memory. The first contains a functional algorithm (program), and the second contains data coming from outside. With a sufficiently complex algorithm, there may be several recorded programs.

Peripheral devices are designed to connect the arithmetic logic unit with the outside world (executive elements of electronic devices). Commonly used peripherals include universal digital ports and I/O interfaces, comparators, analog-to-digital and digital-to-analog converters, motor controllers, pulse width modulators, RF receivers and transmitters. Depending on the functionality and scope of the microcontroller, some of the above devices may be missing.

Without the use of microcontrollers, the operation of computer motherboards (system boards), most household electrical appliances, industrial automation devices and equipment control systems is now impossible. By the way, if you want to build some kind of electronic device yourself or make an industrial upgrade, you can use multifunctional

What does it take to become a professional microcontroller software developer and reach a level of skill that will allow you to easily find and get a job with a high salary (the average salary of a microcontroller programmer in Russia at the beginning of 2015 is
80,000 rubles).

In order to understand what I will talk about, it is desirable that you at least at the initial level know electronics or at least more or less remember the school physics course. If you can’t boast of this, then it’s also not scary, since I will try to explain everything as accessible as possible. Well, if some things remain incomprehensible to you, then ask questions. I only ask you to describe your problem in as much detail as possible so as not to waste your and my time on correspondence with additional clarifications.

For those who have problems watching the video, I will briefly describe its content.

So, the microprocessor and microcontroller are special microcircuits. But how do they differ from each other?

The question is not as simple as one would like. I will say more, I am not sure that I know the correct answer))) However, based on my considerable knowledge and experience, I can try to answer it.

In ancient times, computing systems were built on a variety of microcircuits of various types. Once upon a time, there were no microprocessors at all. Computing systems were first mechanical, then tube, then transistor. Then came the time for integrated circuits.

I happened to work at the first Soviet automatic telephone exchange (ATS) with program control. Its processor was assembled on microcircuits of the 155th series (electronic engineers will understand me). This PBX occupied an entire room.

But over time, the element base became smaller and smaller in size. What used to be assembled from several dozen microcircuits was crammed into one microcircuit. This is how the microprocessor came about.

However, to create a full-fledged computing system, other elements were also required: memory, input-output elements, etc. As a result, the microprocessor system consisted of several microcircuits, and controlled the entire system microprocessor.

However, technology did not stand still. Scientists and engineers have managed to make microchip crystals even smaller. And someone came up with the idea to combine all the elements of a microprocessor system into one microcircuit. So appeared microcontroller.

So modern microcontroller- this is a microcircuit that includes all elements of a microprocessor system, such as a processor, input / output ports, RAM, etc.

Thus, to assemble some simple device, you just need:

  • Develop a device diagram
  • Select microcontroller
  • Write a program for the microcontroller
  • Download the program to the microcontroller (“flash” the microcontroller)
  • Assemble the device
  • Enjoy the result

Difficult? Yes, it's not easy. But if you are one of those who gives up at the first problems, then this profession is not for you. A professional programmer is a strong personality, a person for whom there are no unsolvable tasks.

Application of microcontrollers

Today, microcontrollers are used in almost all electronic devices - from Chinese garlands to control systems for nuclear power plants. Of course, the functionality and reliability of microcontrollers in garlands and at nuclear power plants are different.

Almost all household appliances (with the possible exception of simple electric kettles and similar devices) are controlled by microcontrollers: washing machines, televisions, refrigerators, multicookers, etc.

Modern cars also use microcontrollers in on-board computers.

In general, it is difficult in the modern world to find a sphere of human activity where microcontrollers are not used.

What is the conclusion from this?

Correctly. If you become a professional programmer in the field of developing devices on microcontrollers and programming them, then you will not be left without work. And taking into account the fact that this profession is difficult, and not everyone wants to get involved with it, this work will also be highly paid, since the demand for such specialists is high.

But we will talk about this in future articles. Wait for letters. And if you haven't subscribed yet, then



Loading...
Top