The first thing many people who want to learn microcontrollers ask me is how to learn microcontrollers well? Regarding this issue, I will tell you today how I started learning microcontrollers, how to get started, and how to become proficient in this process.
step
1. Find a book to get a general understanding of the microcontroller structure, and it’s enough to have a general understanding. You don’t have to understand everything, and I won’t let you publish a book. (three days)
2. Find a learning board to practice programming. Learning microcontrollers means practicing programming. If you encounter something you don’t know, ask people or look up books. (twenty days)
3. Find some information on small circuits online to practice designing peripheral circuits. After welding, debug it yourself and become familiar with the process. (ten days)
4. Completely design circuits and products with your own personal style, you are already a master.
Learning and practice of single-chip microcomputer
The improvement of microcontrollers focuses on practice. If you want to learn microcontrollers well, software programming is essential. But being familiar with the hardware is also very important for learning microcontroller 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 the proficiency in using them. In this way we can learn more about the structure of the chip. I believe that after you complete an electronic production of your own, your microcontroller level will be qualitatively improved.
Step One: Use of Digital I/O
Using buttons to input signals and LEDs to display output levels, you can learn the digital I/O functions of the pins. After pressing a certain button, a certain LED lights up. This is the function of combinational logic in digital circuits, although it is very simple. It is simple, but you can learn general MCU programming ideas. For example, you must set up many registers to initialize the pins so that the pins can have digital input and output functions. Every time you use a function of the microcontroller, you must set the register that controls the function. 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 a timer, you can use a microcontroller 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, you can use a microcontroller 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, the light will stay 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 (PLD) can implement sequential circuits, and programmable controllers (PLC) can also implement sequential circuits. However, only microcontrollers are the simplest and lowest cost to implement. The use of timers is very important. Logic plus time control is the basis for the use of microcontrollers.
Step 3: Interrupt
The characteristic of a single-chip microcomputer is that a program is executed repeatedly. The execution of each instruction in the program requires a certain amount of execution time. If the program does not execute an instruction, the action of the instruction will not occur, which will delay many things that happen quickly. Things like, for example, the falling edge when a button is pressed. In order for the microcontroller to respond to fast actions during the normal running of the program, the interrupt function of the microcontroller must be used. This function is that after a fast action occurs, the microcontroller interrupts the normal running program and processes the fast action. After the processing is completed , and then return to execute the normal program.
The difficulty in using the interrupt function is that you need to know precisely when interrupts are not allowed to occur (mask interrupts), when interrupts are allowed to occur (interrupts are enabled), and which registers need to be set to make certain interrupts work. When the interrupt starts, the program should What to do, what should the program do after the interrupt is completed, etc. After you learn how to interrupt, you can compile a program with a more complex structure. Such a program can do one thing and monitor one thing. Once the monitored thing happens, it will interrupt what you are doing and handle the monitored thing. Of course, you can also Monitoring multiple things, vivid metaphor, and interrupt function make the microcontroller 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 martial arts. After mastering three palms, you can barely protect yourself.
Step 4: RS232 communication with PC
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 the PC. The logic levels between them are different, and a MAX3232 chip needs to be used for level conversion.
The use of the 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, etc. Just imagine, the data on the microcontroller experiment board is displayed on the PC monitor, and the PC keyboard signal 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. Through these A/D converters, the microcontroller can operate analog quantities, display and detect signals such as voltage and current. When studying, 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, and is very important in expanding the functionality 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 implement control functions such as motor speed regulator. If you learn all the above seven steps, you can design a general application system, which is equivalent to learning the ten moves to subdue the dragon and the eighteen palms, and you can 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 interfaces, TCP/IP interfaces, and various industrial buses, because this is the current development direction of product development.
So far, it is equivalent to learning 15 moves and the Eighteen Dragon-Subduing Palms, but it is not yet at the level of defeating invincible opponents in the world. Even so, it is still a microcontroller prawn!!
Previous article:Understand UART communication protocol in one article
Next article:Microcontroller study notes, three steps to teach you
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Sandia Labs develops battery failure early warning technology to detect battery failures faster
- Ranking of installed capacity of smart driving suppliers from January to September 2024: Rise of independent manufacturers and strong growth of LiDAR market
- Industry first! Xiaopeng announces P7 car chip crowdfunding is completed: upgraded to Snapdragon 8295, fluency doubled
- P22-009_Butterfly E3106 Cord Board Solution
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- What is 4G DTU and what are its specific functions?
- CadenceLIVE China 2022 China Online User Conference invites you to attend
- Super detailed summary of receiver sensitivity and equivalent noise bandwidth
- Difference between junction temperature and case top temperature of power device
- The problem of grounding the output signal of the half-bridge inverter circuit
- Xianyu not only hired someone to do their graduation project, but also tried to "extort" money from the seller. It's a pity for these two students from Xidian University...
- 3-wire spi (cs clk sda), LCD driver for HX8369
- 8 DDR3 surface-to-bottom mounting solution
- Where are the options for PCB material/PCB copper thickness/PCB spray color/milling edge in the Gerber file of Altium Designer?
- Basic knowledge of SCI serial port programming of TMS320F28035