AVR-ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅. ΠŸΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅ ΠΌΠΈΠΊΡ€ΠΎΠΊΠΎΠ½Ρ‚Ρ€ΠΎΠ»Π»Π΅Ρ€ΠΎΠ² AVR для Π½Π°Ρ‡ΠΈΠ½Π°ΡŽΡ‰ΠΈΡ…

Microcontrollers are small, but at the same time very convenient devices for those who want to create various amazing robotic or automated things at home. As part of this article, AVR programming for beginners, various aspects and nuances of this process will be considered.

general information

avr programming




Microcontrollers can be found everywhere. They are in refrigerators, washing machines, telephones, machine tools in production, smart homes, and even in many different technical devices. Their widespread use is due to the possibility of replacing more complex and large-scale analog device circuits. Programming MK AVR allows you to provide autonomous control over electronic devices. These microcontrollers can be thought of as the simplest computer that can interact with external technology. So, they can open / close transistors, receive data from sensors and display them on screens. Also, microcontrollers can perform various processing of input information like a personal computer. If you master AVR programming from scratch and reach the professional level,This opens up almost limitless possibilities for controlling various devices using input / output ports, as well as changing their code.





A bit about AVR

c programming




The article will consider a family of microcontrollers manufactured by Atmel. They have pretty good performance, which allows you to use them in many amateur devices. Widely used in industry. You can find in this technique:

  1. Domestic. Washing machines, refrigerators, microwave ovens and more.
  2. Mobile Robots, communications, and so on.
  3. Computational. Peripheral device control systems, motherboards.
  4. Entertaining. Jewelry and children's toys.
  5. Transport. Security and engine management systems.
  6. Industrial equipment. Machine control systems.

, , . , , . . Assembler, . - , , , . AVR- .









?

AVR- :

  1. .
  2. .

. :

  1. .
  2. Get a device as part of the designer (for example - Arduino).
  3. Assemble the microcontroller yourself.

In the first paragraph there is nothing complicated, so immediately go to the second and third.

Get a device as part of the designer

programming courses




The famous Arduino will be chosen as an example. This is an electronic constructor,part-time convenient platform for fast and high-quality development of various electronic devices. The Arduino board includes a certain set of components for operation (there are various configurations). It necessarily includes an AVR controller. This approach allows you to quickly start developing the device, does not require special skills, has significant opportunities in terms of connecting additional boards, and also on the Internet you can find a lot of information on questions of interest. But there were some cons. Buying an Arduino, a person deprives himself of the opportunity to plunge deeper into AVR programming, to better know the microcontroller, the specifics of its work. A relatively narrow line of models also adds negativity, which is why you often have to buy boards for specific tasks. A feature is alsothat programming in "SI" here is quite different from the standard form. Despite all its flaws, the Arduino is suitable for beginners to explore. But do not abuse.

, AVR . , . , , , , . , , .

?

programming software avr




So, let's say that the issue with the microcontroller has been resolved. Further, it will be considered that it was acquired or purchased independently. What else do you need to master AVR programming? For this purpose, you need a development environment (a regular notepad is also suitable as a basis, but I recommend stopping at Notepad ++). Although there are other programs for programming AVR, the above software will be able to cope with all the requirements. A programmer is also needed. It can be purchased at a nearby store, ordered online, or assembled on your own. The circuit board does not hurt. It is not required, but its use allows you to save your nerves and time. Also bought / created independently. And the last one is the power source. For AVR, a voltage supply of 5V must be provided.

Where and how to study?

. , . ? . . ( ) . . , , . - , . , . , , , "", "" .

/

mk avr programming




This is an extremely important topic. Without an understanding of how I / O ports work, in-circuit AVR programming in general is not possible. After all, the interaction of the microcontroller with external devices is carried out precisely with their mediation. At first glance, a beginner might think that the port is a rather confusing mechanism. To avoid such an impression, we will not consider in detail the scheme of its work, but only get a general idea about it. Consider a software implementation. As an example of the device, the AtMega8 microcontroller was chosen - one of the most popular of the entire AVR family. The input / output port is three registers that are responsible for its operation. At the physical level, they are realized as legs. Each of them corresponds to a specific bit in the control registry.Each leg can work both for inputting information, and for its output. For example, you can hang the function of ignition of the LED on it or the processing of pressing a button. By the way, the three registers that were mentioned are: PORTx, PINx and DDRx. Each of them is eight-bit (do not forget that we are considering AtMega8). That is, one bit is engaged in a certain leg.

DDRx. . 0 1. ? 0, . , . 1, - (, ). PORTx. . . , . PORTx, . , . . DDRx , . PINx. , . , PINx . . – .

AVR . , . . , PIC/AVR . - , . AVR , , - .

in-circuit avr programming




When programming the AVR microcontrollers on "SI" or on "Assembler", it is necessary to work very carefully. The fact is that by setting a certain combination of registers and changing the internal settings, you can safely lock the microcontroller. This is especially true for fuses. If you are not sure of the correctness of your actions, then it is better to abandon their use. The same applies to programmers. If you buy factory equipment, it will flash microcontrollers without problems. When assembling with your own hands, a sad situation may arise in which the programmer locks the device. This can happen either due to an error in the program code, or through a malfunction in it. By the way, about another (this time positive) point that was previously mentioned in passing,but it was not fully disclosed. Now almost all modern microcontrollers have the function of in-circuit programming. What does it mean? Let's say that the device was soldered on the board. And to change its firmware, now you do not need to evaporate it, because such an intervention can damage the microcontroller itself. It is enough to connect to the corresponding conclusions and reprogram it through them.

?

AtMega8. , , , . - , Atmega128. . , , . . , , – . , . AtMega8, .

pic avr programming




So the topic of AVR programming in the most general terms was considered. Of course, much more can be said. So, for example, marking of microcontrollers was not considered. And it can say a lot. So, basically microcontrollers operate at a voltage of 5V. Whereas the presence, for example, of the letter L can say that only 2.7 V is enough for the device to work. As you can see, sometimes knowledge about marking can play a very important role in terms of the correct and durable operation of the devices. The operating time of microcontrollers is also an interesting topic. Each device is designed for a certain period. So, some can work out a thousand hours. Others have a guarantee stock of 10,000!




All Articles