How to quickly learn microcontrollers?

Publisher:爱笑的猫咪Latest update time:2013-03-04 Source: 21IC Keywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Many people ask how to learn microcontrollers quickly. Let me briefly explain it.

There are 6 requirements for learning MCU quickly:

1. Familiar with the principle and structure of single chip microcomputer;

2. Learn digital electronics and analog electronics to lay a solid foundation for circuit design;

3. Be proficient in using C language and learn other people's programs;

4. Have a certain understanding of the operating system principles;

5. You need to have at least some basic knowledge of Protel;

6. The ability to actually debug circuits.

Steps to learn microcontrollers

There are many types of single-chip microcomputers, but 51 is the most basic, so it is best to start learning single-chip microcomputers from 51, which is not only easy to use, but also very practical. However, 51 single-chip microcomputers are too basic after all, and many subsequent single-chip microcomputers have greatly expanded their functions. Therefore, according to the route of most people in our laboratory, most people will learn AVR single-chip microcomputers next. AVR single-chip microcomputers have greatly improved functions compared to 51, integrating many practical functions such as A/D and fast PWM, and have many similarities in functions with many large single-chip microcomputers. Therefore, if you want to master other single-chip microcomputers in the future, AVR is undoubtedly a good springboard.

The learning process

The ultimate goal of learning MCU is, of course, practice. The learning I am talking about is different from the MCU learning in class. I have read some MCU textbooks before. Some of them talk about the working principle and internal structure of MCU. These things are not needed for us for the time being. We can learn them when the class starts in the future. What we need to learn now is how to write some simple small programs with MCU, putting aside the internal structure principle for the time being. It is from the perspective of practicality. There is a saying on the Internet that it is a learning method called practice first and then theory.

Therefore, my point of view is as follows: first of all, you need to have a basic understanding of the hardware structure of the microcontroller. At least you need to know the functions and differences of each pin, and be able to build a minimum system of a microcontroller by yourself. Then you can start directly with the program. It is best to program in C language, starting with a simple marquee, and gradually deepening. You can gradually make some digital tubes, LCDs, DS1302, DS18B20 and other electronic components. In-depth, you can combine some specific examples to expand some interrupts, serial communication and other functions. Another point to be stated is that the C language used in the microcontroller is actually very limited. A large part of the content learned in C++ in class is not used in the initial microcontroller programming. Therefore, there is no need to stop at the microcontroller because you feel that your C language foundation is not very good!

Tools for learning

In terms of software, the 51 microcontroller uses KEIL software, which is available in the school library software download and other websites. You can find relevant information on the specific usage. There are more software for AVR. I use CVAVR. There are also ICCAVR and other compiler software. It depends on personal preference. It is recommended to learn after you have a certain 51 foundation. Another is the burning software. The function of the burning software is to burn the HEX file generated by the compiler into the microcontroller. This is practical with the download line. If there is a parallel port, it is best to use a parallel port download line. The software is best to use Guangzhou Shuanglong's SLISP software. If the laptop does not have a parallel port, you have to buy a downloader yourself, called USBASP, which is sold in the online electronic market for about 20 yuan. The software will come with the CD.

In terms of hardware, first of all, you need a single-chip microcomputer. There is one thing to note about single-chip microcomputers. It is best to buy 89S51 and 89S52 models of 51 single-chip microcomputers. The burning program I mentioned above is the ISP method. These two single-chip microcomputers support ISP download, so if you buy other models of burning programs, it may not be convenient. The AVR single-chip microcomputer commonly uses ATmega16L. The difference between other models is not very big, and some are even compatible. As for the single-chip microcomputer development board, the current price is very expensive, ranging from one hundred to several hundred. However, it is better to avoid the one that costs more than 60 yuan advertised in the school last time, which is of little use. It is of course good to buy one, but it doesn’t matter if you don’t have it. It is also very convenient to buy a circuit board and build it yourself. It is very easy to lead out the ISP interface and burn the program, and then it is also very convenient to lead out the I/O port for expansion.

Several other points to note when learning microcontrollers:

1. Give equal weight to theory and practice

For a beginner of single-chip microcomputer, if you learn in a textbook way, you will be faced with a lot of instructions and nouns. After learning for a long time, you still can't figure out what these instructions do. Maybe you will feel boring and give up halfway in a few days. Therefore, it is a good method to combine learning with practice. You can learn and practice at the same time, step by step. In this way, you can understand, grasp and root the instructions used in your mind in a few times, and even "deeply rooted". In other words, after you have learned a few instructions (not a large number at a time, but understanding), you should do experiments next. Through experiments, you can feel the control effect of the instructions just now, see the eyes (light) and hear the ears (sound), and you can deeply understand how the instructions are converted into signals to achieve control. Seeing the results of your learning through experiments not only gives you a sense of accomplishment, but also enhances your interest in single-chip microcomputers. To be honest, single-chip microcomputers are not so much learned as practiced through experiments. Moreover, doing experiments themselves is also a learning process. Therefore, the learning method of learning while practicing is particularly effective.

2. Arrange your time reasonably and persevere

Learning single-chip microcomputers cannot be done in a half-hearted way. You need to have perseverance and determination. After learning a few instructions, you should do experiments in time to integrate them. Don't wait for a few days or weeks to do experiments. This will not be effective and you may even forget what you learned. In addition, you must be mentally prepared to fight a "protracted war". Don't study for a few days when you are interested and give up for a few weeks when you are not interested. Perseverance is a very important point in learning single-chip microcomputers. [page]

3. Check patiently when encountering problems

MCU has both hardware and software. Sometimes a program does not work no matter how you adjust it, but it is correct from a theoretical analysis. In this case, you need to carefully find the reason. When learning MCU, you often encounter many problems, and sometimes you can't solve them in a day or two. In this case, you need to be patient and start from the bottom. I believe that every time you find an error, you will gain something new. Don't give up easily!!!

4. Knowledge that has only been learned briefly is only slightly better than a superficial understanding at best. Therefore, the better method is to relearn it after a period of time (1-2 months), and use the knowledge learned frequently. In this way, you can thoroughly understand and digest it by repeating it several times and never forget it.

5. Make appropriate investments to purchase experimental equipment and books and materials

The technology of single-chip microcomputer is of high value. Once you learn it, the benefits it brings to you are also high. Whether you are applying for a job or starting a factory or company, the prospects are bright and unlimited. Therefore, when learning, you should be willing to invest appropriately to purchase necessary learning and experimental equipment. In addition, you should often go to science and technology bookstores to buy some books suitable for your own learning and improvement. A good book is really important. You can read it at any time and supplement the knowledge you don’t understand or forget at any time.

Learning to use a microcontroller means understanding the microcontroller hardware structure and the application of internal resources, learning how to initialize various functions in assembly or C language, and how to compile programs to implement various functions.

Step 1: Use of Digital I/O

By using buttons to input signals and LEDs to display output levels, you can learn the digital I/O functions of pins. After pressing a button, a LED lights up. This is the function of combinational logic in digital circuits. Although it is very simple, you can learn general microcontroller programming ideas. For example, many registers must be set to initialize the pins so that the pins have digital input and output functions. Every time a function of the microcontroller is used, the register that controls the function must be set. This is the characteristic of microcontroller programming. Don't be afraid of trouble. All microcontrollers are like this.

Step 2: Use of timer. Once you learn how to use the timer, you can use a single-chip microcomputer to implement a sequential circuit. The function of the sequential circuit is powerful and has many applications in the control of industrial and household electrical equipment. For example, a single-chip microcomputer can be used to implement a corridor light switch with a button. After the button is pressed once, the light will automatically turn off after 3 minutes. When the button is pressed twice in succession, the light will always be on. When the button is pressed for more than 2 seconds, the light will turn off. Digital integrated circuits can implement sequential circuits, programmable logic devices (PLDs) can implement sequential circuits, and programmable controllers (PLCs) can also implement sequential circuits, but only single-chip microcomputers are the simplest and lowest cost to implement.

The use of timers is very important. Logic plus time control is the basis of the use of microcontrollers.

Step 3: Interrupt

The characteristic of a single-chip microcomputer is that a program is repeatedly executed. The execution of each instruction in the program requires a certain execution time. If the program does not execute a certain instruction, the action of the instruction will not occur, which will delay many fast-moving things, such as the falling edge when a button is pressed. In order to make the single-chip microcomputer respond to fast actions during the normal operation of the program, the interrupt function of the single-chip microcomputer must be used. This function is that after the fast action occurs, the single-chip microcomputer interrupts the normal running program and processes the fast action. After the processing is completed, it returns to execute the normal program. The difficulty in using the interrupt function is that it is necessary to accurately know when to not allow interrupts to occur (shield interrupts) and when to allow interrupts to occur (enable interrupts), which registers need to be set to make a certain interrupt work, what the program should do when the interrupt starts, what the program should do after the interrupt is completed, etc.

After learning about interrupts, you can compile programs with more complex structures. Such a program can do one thing and monitor one thing. Once the monitored thing happens, it will interrupt the thing it is doing and handle the monitored thing. Of course, it can also monitor multiple things. Figuratively speaking, the interrupt function enables the microcontroller to have the function of eating from the bowl and watching the pot.

Learning the above three steps is equivalent to the Eighteen Dragon Subduing Palms. If you have mastered three of the palms, you can barely protect yourself.

Step 4: RS232 communication with PC

All microcontrollers have USART interfaces, especially many models in the MSP430 series, which have two USART interfaces. The USART interface cannot be directly connected to the RS232 interface of a PC. The logic levels between them are different, so a MAX3232 chip is needed for level conversion.

The use of USART interface is very important. Through this interface, information can be exchanged between the microcontroller and the PC. Although RS232 communication is not advanced, it is very important to learn the interface. To use the USART interface correctly, you need to learn the communication protocol, PC RS232 interface programming and other knowledge. Imagine that the data on the microcontroller experiment board is displayed on the PC monitor, and the keyboard signal of the PC can be displayed on the microcontroller experiment board. How interesting it would be!

Step 5: Learn A/D conversion

The MAP430 microcontroller has a multi-channel 12-bit A/D converter, which can be used to operate analog quantities, display and detect voltage, current and other signals. When learning, pay attention to concepts such as analog ground and digital ground, reference voltage, sampling time, conversion rate, and conversion error.

A simple example of using the A/D conversion function is to design a voltmeter.

Step 6: Learn PCI, I2C interface and LCD interface

The use of these interfaces can make it easier for the microcontroller to connect to external devices, which is very important in expanding the functions of the microcontroller.

Step 7: Learn to compare, capture, and PWM functions

These functions enable the microcontroller to control the motor, detect the speed signal, and realize the control functions such as the motor speed regulator.

If you have learned all the above seven steps, you can design a general application system, which is equivalent to learning the ten moves of the Eighteen Dragon Subduing Palms and being able to attack.

Step 8: Learn the hardware and software design of USB interface, TCP/IP interface, and various industrial buses. It is very important to learn the hardware and software design of USB interface, TCP/IP interface, and various industrial buses, because this is the current direction of product development.

So far, it is equivalent to learning 15 moves of the Eighteen Dragon Subduing Palms, but it is not enough to be invincible. Even so, it is still considered a master of single-chip computers.

Keywords:MCU Reference address:How to quickly learn microcontrollers?

Previous article:Common faults of single chip microcomputer and their solutions
Next article:Single chip microcomputer controlled flash light circuit

Recommended ReadingLatest update time:2024-11-17 05:39

MCU reads 4*4 matrix keyboard
1. What is a matrix keyboard? A matrix keyboard is a keyboard group with a matrix-like layout used in external devices of a single-chip microcomputer. Since more external inputs are required during circuit design, controlling a single button would waste a lot of IO resources, so a matrix keyboard was created. Commonly
[Microcontroller]
MCU reads 4*4 matrix keyboard
Design of a high performance broadband DC amplifier based on AVR microcontroller
Introduction: This paper combines the design scheme and existing problems of general amplifiers, discusses the detailed design method of each unit circuit of the programmable broadband DC power amplifier, and proposes the design scheme and implementation method of a programmable broadband DC amplifier with large dynam
[Microcontroller]
Design of a high performance broadband DC amplifier based on AVR microcontroller
ADC0832 analog-to-digital conversion MSP430 microcontroller program + circuit diagram
Here is the circuit diagram:                   ADC0832 package diagram          ADC0832 and microcontroller connection diagram ADC0832 timing diagram Program source code download:  http://www.51hei.com/f/0832430.rar #include msp430f2121.h #define DO (P1IN&BIT7) #define uchar unsigned char #define uint u
[Microcontroller]
ADC0832 analog-to-digital conversion MSP430 microcontroller program + circuit diagram
Design of a method to control inverter bridge based on SPWM signal generated by PIC microcontroller
1 Introduction With the continuous development of information technology and the increasing popularity of computer applications, high-tech equipment has higher and higher requirements for power supply quality. Many devices require the power supply to continuously provide constant frequency, constant voltage, and pure
[Microcontroller]
Design of a method to control inverter bridge based on SPWM signal generated by PIC microcontroller
Design of waveform signal generator based on single chip microcomputer
1. Experimental purpose 1. Understand the interface method between D/A conversion and single-chip microcomputer. 2. Understand the performance and programming method of D/A conversion chip 0832. 3. Understand the basic method of using D/A conversion chip to generate various waveform signals in single-chi
[Microcontroller]
Design of waveform signal generator based on single chip microcomputer
Using C language for PIC microcontroller (I)
Using HitechC Compiler in MPLAB-IDE 1. Load the compiler:     1. Start MPLAB-IDE and select Project-》Install Language Tool as shown below     2. In the pop-up Install Language Tool dialog box, the "Language Suite" option now shows Microchip. Click the arrow behind it to select the language. The tool I use is HI
[Microcontroller]
Using C language for PIC microcontroller (I)
A remote temperature monitoring system based on single chip microcomputer and FPGA
Temperature has different degrees of influence on industrial and agricultural production and national defense. There are many kinds of power equipment failures, but most of them are accompanied by heating, and the loss of an accident is huge; in industries such as textiles, food, and tobacco, high temperatures can e
[Embedded]
A remote temperature monitoring system based on single chip microcomputer and FPGA
51 single chip microcomputer mobile phone dialing module
#include AT89X52.h #include intrins.h #define Delaynop(){_nop_();_nop_();_nop_();_nop_();} sbit RS=P2^0; sbit RW=P2^1; sbit EN=P2^2; void Delayms(unsigned int ms); bit LCD_Busy(); void LCD_Pos(unsigned char); void LCD_Wcmd(unsigned char); void LCD_Wdat(unsigned char); char code Title_Text ={"--Phone Code-- 
[Microcontroller]
51 single chip microcomputer mobile phone dialing module
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号