My experience in learning microcontroller

Publisher:RoboPilotLatest update time:2013-03-04 Source: 21icKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The first question many people who want to learn microcontrollers ask me is how can they learn microcontrollers well? For this question, today I will tell you how I started learning microcontrollers, how I got started, and how I became proficient in the process.

Let's talk about the single-chip microcomputer first. Generally, the MCS-51 single-chip microcomputer that we use more now has a lot of information, many people use it, and the market is also very large. In my personal experience, how can I learn the single-chip microcomputer course faster? The single-chip microcomputer course is a subject that attaches great importance to hands-on practice. You can't always read books, but you must read books first to learn it, because from the book you need to have a general understanding of the various functional registers of the single-chip microcomputer. To put it more clearly, we use the single-chip microcomputer to control the various functional registers of the single-chip microcomputer with software. To put it more clearly, it is to control when the level of those pins of the single-chip microcomputer outputs high and when it outputs low. These changes in high and low levels control your system board and realize the various functions we need. As for reading books, you only need to have a general understanding of what each pin of the single-chip microcomputer does? What kind of functions can it achieve? You may not understand it the first time or the second time, but it doesn't matter, because you still lack practical sensory understanding. So I always say that it is enough to read books for two or three days to learn single-chip microcomputers. You can read five or six novels a day, and it is enough to read single-chip microcomputers two or three times in two or three days. You don't need to read them carefully. I recommend a book. This one is enough. The title is "New MCS-51 Single-chip Microcomputer Application Design", which is published by Harbin Institute of Technology Press and the author is Zhang Yigang. It is very important to have a general understanding of the content of the book and then practice. If you don't practice to learn single-chip microcomputers, it is impossible to learn. There are two ways to practice. One way is to spend money to buy a single-chip microcomputer learning board. It doesn't require too many functions. For beginners, you buy a board with many functions. There are many things on it that you will never use in your life. I suggest running lights, digital tubes, independent keyboards, matrix keyboards, AD or DA (the principle is the same), LCDs, buzzers, and that's about it. If you can apply the above-mentioned things skillfully, it can be said that you have already entered the hardware of single-chip microcomputers. The rest is to practice designing circuits by yourself and constantly accumulate experience. As long as you pass the first level, the rest of the road will be much easier. Everyone may have heard that everything is difficult at the beginning. Method 2: If you have an expert in single-chip microcomputers around you, ask him for help and let him help you build a simple minimum system board. For an expert, it only takes one minute to make a minimum system board for a single-chip microcomputer, but it is much more difficult for a beginner, because only when you understand the hardware can you use it skillfully. If you don’t have such an expert around you and can’t find someone who can help you, then I advise you to buy one yourself. After all, it is much more convenient to have one yourself. You can use it when doing small experiments such as single-chip microcomputers in the future, and it is also trouble-free.

After you have a MCU learning board, you should practice more. It is best to have a computer of your own. Watch fewer movies and play fewer games every day. Connect the learning board and computer, open the debugging software and sit in front of the computer. First learn how to use the debugging software, and then start with the simplest running light experiment. When you can make the eight running lights flow freely according to your wishes, you have already got started. You will find how fascinating the MCU is. It is so fun. This is not learning knowledge, but playing. When the program you wrote is realized according to your wishes, you are happier than doing anything else. You will be addicted, really. People who work in electronics are really addicted. Then make the digital tube light up. After these two things, you can't help yourself. You have begun to consider what career you want to take in this life. This is how you practice. You will definitely encounter many problems when writing programs. At this time, you can look for them in books or ask others. When you get the answers, you will remember them for a lifetime. Knowledge must be used in real life to solve practical problems. Only in this way can it play its role. Think about it yourself. You have been in college for so many years and have been in class every day. What have you learned in class? Are you busy for the final exam? You got 90 points after the exam, hahaha, so happy, but you forgot everything when you came back to school next semester, right? What did you learn? But I tell you that once you learn the microcontroller, you will never forget it. In addition, let me talk about the problem of programming in assembly and C language. Many students have C language courses in their freshman and sophomore years. I have also taken them. I know that at that time, every day I was multiplying, adding, and calculating factorials. What's the use of learning it? Would you be stupid if you were asked to program a microcontroller in C language? We must be able to use the things in the book. Microcontroller programming can be done in C language or assembly language, but I suggest that C language is better. If you have a foundation in C language, it will be easier to learn. If not, you can also learn C language while learning microcontroller. C language is also very simple, just a tool. I advise you to learn it, it will definitely be useful in the future, otherwise you will have to learn it in the future. It doesn't matter if you don't know any assembly language, but you will suffer in the future if you don't know any C language. Assembly language is efficient in writing program codes, but it is relatively difficult and verbose, especially when encountering algorithm problems, it is very troublesome. Now the main frequency of microcontrollers is constantly increasing, and we don't need such efficient code at all, because there is a high-frequency clock, and the ROM of microcontrollers is also constantly improving, which is enough to hold any code you write in C language. There are a lot of C language materials and they are easy to find. It will be very portable in the future. You only need to change an IO port to write a temperature sensor program and it can be used anywhere, so I advise everyone to use C language.

To sum up, as long as you have confidence, can stick to what you do, and have a strong will not to give up until you succeed, then learning a microcontroller is a very easy thing.

Steps: 1. Find a book to learn about the structure of the microcontroller. Just get a general understanding. You don't have to understand everything. I won't let you publish a book. (Three days)

2. Find a learning board to practice programming. Learning microcontrollers is all about practicing programming. If you encounter something you don’t know, ask someone or look up a book. (20 days)

3. Find some small circuit materials on the Internet and practice designing peripheral circuits. After soldering, debug by yourself and get familiar with the process. (10 days)

4. Design your own circuits and products with your own personal style. You are already a master.

Did you see it? If you work hard for more than a month, you can become a master. That’s all I have to say. It depends on you whether you can learn it or not and whether you can put in the effort.

My experience in learning microcontrollers.

Many people say that it is best to learn assembly language before learning MCU. From my experience, I can tell you that this is absolutely not necessary. Beginners can directly use C language to program MCU from the beginning, which not only saves time, but is also easy to learn and will improve quickly. When you first start learning MCU, don't waste time trying to understand the internal structure of the MCU. This will only undermine your confidence. When you learn programming, you will naturally master its internal structure step by step.

Learning and practice of single chip microcomputer.

The key to improving MCU is practice. If you want to learn MCU well, software programming is essential. But being familiar with hardware is also very important for learning MCU well. How to learn hardware well, hands-on practice is essential. We can make our own electronic production by ourselves, and by completing it, we can improve our understanding of some chips and use them proficiently. In this way, we can learn more about the structure of the chip. I believe that when you complete an electronic production of your own, your MCU level will be qualitatively improved.

This is my experience in learning MCU, I hope it will be helpful for MCU enthusiasts to learn MCU well. [page]

Using a microcontroller means understanding the microcontroller hardware structure and the application of internal resources, and learning the initialization settings of various functions in assembly or C language.

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 the timer

Once you learn how to use a timer, you can use a single-chip microcomputer to implement a sequential circuit. The function of a 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 a row, 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, and logic plus time control is the basis for the use of single-chip microcomputers.

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 operation of the program, processes the fast action, and returns to execute the normal program after the processing is completed. The difficulty in using the interrupt function is that it is necessary to accurately know when the interrupt is not allowed to occur (shield interrupt) and when the interrupt is allowed to occur (open interrupt), 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 programs can do one thing and monitor one thing. Once the monitored thing occurs, it interrupts the thing being done and processes the monitored thing. Of course, it can also monitor multiple things. Figuratively speaking, the interrupt function enables the single-chip microcomputer 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, conversion error, etc. 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 of 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 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 development direction of product development.

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

And program compilation to realize various functions.

Keywords:MCU Reference address:My experience in learning microcontroller

Previous article:Introduction to various programmers for single chip microcomputers
Next article:What are microcontroller clock cycle, machine cycle, and instruction cycle?

Recommended ReadingLatest update time:2024-11-16 15:40

51 MCU converts the solar calendar to the lunar calendar (only the routine of converting the solar calendar to the lunar calendar)
I wanted to make a perpetual calendar before. I searched many forums and finally found the following program for converting the solar calendar to the lunar calendar. It is relatively simple and can be used directly after the data is entered. However, the test found that there was a problem with the conversion. Later,
[Microcontroller]
ATmega 16 MCU WDT timer related registers (Part 7)
1.WDTCR——Watchdog Timer Control Register               – – – WDTOE WDE WDP2 WDP1 WDP0 Bit - Res: Reserved bits ATmega16 reserved bits, read operations return a value of zero. Bit 4 - WDTOE: Watchdog modification enable WDTOE must be set when WDE is cleared, otherwise the watchdog cannot be disabled. Once set, t
[Microcontroller]
ABDAC peripheral audio playback design on AVR32 MCU
  The ABDAC peripheral on the AVR32 MCU is ideal for generating audio playback. This article explains how to do this and includes a link to a sample driver that generates a sine wave output.   Many embedded applications increasingly feature audio playback capabilities, whether simple audio feedback in response to us
[Microcontroller]
ABDAC peripheral audio playback design on AVR32 MCU
How to encrypt MSP430 microcontroller?
1. Why and how to encrypt? When your product is launched on the market, your competitors will start to target it. If the hardware of your product is easily imitated and the MSP430 microcontroller you use is not encrypted, then your hard-earned success can easily become your competitor's product. Although the JTAG debu
[Microcontroller]
Use of EEPROM inside STC microcontroller - Recording power-on times
In most cases, 24C02 is used to store power-off data. In some situations where cost needs to be considered, the internal EEPROM can also be considered. This program introduces the use of the EEPROM inside the STC. The function of the program is to record the number of power-on times, then add 1 and display it on the d
[Microcontroller]
Design of car light node based on μPD780822 single chip microcomputer and CAN bus module
1. Introduction CAN (Controller Area Network) was first proposed by Bosch of Germany. It is the most popular and commonly used bus in the automotive controller area network. Its main features are: CAN bus is a multi-master bus. Each node can actively send information to other nodes on the network at any time, r
[Embedded]
Design of car light node based on μPD780822 single chip microcomputer and CAN bus module
Implementation Analysis of 51 Microcontroller IIC Bus
The IIC bus (inter integrated circuit bus) is a high-performance inter-chip serial synchronous transmission bus invented by Philips. Unlike the SPI and Microwire interfaces, it only requires two signal lines - the serial data line SDA and the serial clock Line SCL realizes duplex synchronous data transmission, which c
[Microcontroller]
Implementation Analysis of 51 Microcontroller IIC Bus
RW61X: Wi-Fi 6 tri-band device in a secure i.MX RT MCU
Currently, there are at least 100 connected devices using different wireless standards in smart homes and modern buildings. NXP RW61x is a highly integrated, secure, tri-band wireless MCU that provides a powerful solution for this need through simple and efficient wireless connectivity. RW61x
[Embedded]
RW61X: Wi-Fi 6 tri-band device in a secure i.MX RT MCU
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号