Microcontrollers are a common course for electrical engineering majors in colleges and universities. Some schools even list it as an elective course. Among the many courses, it does not show how important it is. Why should we learn it? Electrical engineering majors have many professional courses. These professional courses are very important and are necessary courses for all majors. After completing these courses, learners can become the successors of great scholars. The market demand for successors of scholars is too small. What is needed in large quantities are product developers. Product development requires practical work and development tools. Microcontroller courses are courses that teach how to use development tools. Learning microcontroller courses is different from theoretical courses. You cannot just do homework, but you must actually use microcontrollers. The following is a brief description of some immature ideas on how to prepare for the conditions and learning steps of learning microcontrollers.
1. Hardware
(1) Programming hardware Programming
is to burn the program that the microcontroller runs into the memory of the microcontroller. At present, most microcontrollers use FLASH memory. The number of writes to these memories is generally about 1,000 times, but there are also 10,000 or 100,000 times. Programming is also called program downloading or burning.
(2) Real-time simulation hardware
Real-time simulation is to use a PC to monitor the program actually running in the MCU with software. That is, after the program is downloaded to the MCU, the program is run in real time, breakpoints are set in the program, and the program operation is monitored and controlled through the simulation interface. This process is actually debugging the program (actually verifying the correctness of the program).
The programmer and the simulator can be one device or independent devices.
2. Software
MCU development requires the support of MCU development software, which is divided into:
(1) Programming software
This software supports the programmer and helps the programmer write the program into the MCU.
(2) Real-time simulation software
This software can debug the MCU program with the support of the simulation interface.
(3) Virtual simulation
This type of software supports debugging of MCU programs without MCU hardware.
(4) Support C language
All MCU development software supports assembly language programming, but people currently prefer C language programming, mainly because C language is powerful and can shorten development time.
Currently, there are software that supports the above functions, such as Keil 51 of the 51 series, MPLAB of the PIC series, and IAR of the MSP430 series.
3. Means of learning single-chip microcomputers
According to economic strength, the means of learning single-chip microcomputers are divided into the following categories:
(1) Buy a single-chip microcomputer book and study it carefully.
(2) Download a single-chip microcomputer development software with simulation function (preferably supporting C language) from the Internet, and virtually simulate the single-chip microcomputer on the computer.
(3) Purchase a programmer (the download software that supports the programmer is provided by the programmer manufacturer) and an experimental board (also called a demonstration board or target board), and download the development software from the Internet. With the support of the development software, virtually simulate the single-chip microcomputer. After confirming that the single-chip microcomputer program is correct, use the programmer to download the program to the single-chip microcomputer and observe the actual operation of the program.
(4) Purchase a simulation interface and an experimental board, download the single-chip microcomputer development software (supporting programming, virtual simulation,
real-time simulation and C language) from the Internet, and after the virtual simulation is completed, download the program to the single-chip microcomputer for real-time simulation.
For personal learning of single-chip microcomputers, having the above (4) conditions is already very good.
4. Confusion in the process of learning single-chip microcomputers There
are many types of single-chip microcomputers. The single-chip microcomputers, development hardware and software functions, and prices provided by different companies are all different. There are many confusions for beginners to learn single-chip microcomputers.
(1) Single-chip microcomputer issues There are
many single-chip microcomputers at present. It doesn’t matter which one you learn. Although single-chip microcomputers are of different models, the types of resources inside the chip are similar, and the methods of using these resources are also similar. It can be said that if you learn one, you will be able to master the other types. Which one to learn depends mainly on the conditions you have.
The 51 series is an old model with many books and materials, open software and hardware support. In particular, the AT89 series, a product of Atmel, is a product of Atmel. Many people have made their fortunes by learning this single-chip microcomputer. The
AVR90 series is also a product of Atmel. It has few instructions and is easy to learn. There are many types of chips, which are suitable for various occasions and needs. According to relevant information, the number of single-chip microcomputer chips in use is very large, and there is a trend of exceeding the number of 51 series chips.
PIC series, this series is a product of Microchip, with many types and strong anti-interference ability. Many people use it, especially the PIC 16F877 chip. Because it is suitable for school use, with the support of the company's university plan, it gives away free development tools and experimental boards, so the number of people using this chip has increased greatly. It is also a microcontroller that can compete with the 51 series microcontroller.
MSP430 series, a product of TI, was introduced by Hangzhou Lierda Company in recent years. It is a 16-bit, ultra-low power microcontroller, especially suitable for the development of low-power devices such as handheld devices. In fact, because this series has many pins and many internal resources (with hardware multipliers), it has a place in many product developments. According to relevant people, this series is the most promising microcontroller.
There are many other microcontroller models. Since I don't know much about them, I dare not comment on them. But I can imagine that they must be good microcontrollers, otherwise they would not exist in the fiercely competitive market.
(2) Development software issues
Different types of microcontrollers are equipped with corresponding development software, and many of these software are developed by professional software companies.
The current development software for the 51 series is Keil 51, which supports C language, but the version downloaded from the Internet only supports 2K programs.
The development software for the PIC series is MPLAB, which is very easy to use with the support of HI-TECH's C language support software PICC, but PICC requires an activation password to run.
The development software of the MSP430 series is IAR. This software has a one-month full-featured limited-time version and a C language 4k support version. It can be seen that the software openness of this series is the best.
The more open the development software of a microcontroller is, the more people will be interested in the microcontroller. Microcontroller providers are also well aware of this, so more open versions of software can often be found online.
(3) Simulation interface
Simulation interface, also known as emulator, is very difficult to simulate programming because old microcontrollers do not have FLASH memory. New models of microcontrollers almost all have FLASH memory chips. Such chips support in-circuit programming (in-system programming). The so-called in-circuit programming is to write the program into the microcontroller with 3 to 5 wires, and to transmit the program running status, register contents and other information in the microcontroller to the PC. This programming method requires the installation of a simulation interface between the microcontroller and the PC, which generally needs to be purchased.
AT89S51 and PIC16F877 are microcontrollers with this capability. However, for beginners, the interface that supports the programming and simulation of the microcontroller needs to be purchased, and the simple interface will occupy chip resources during simulation, which brings inconvenience to the development of the microcontroller system.
The MSP430 series microcontrollers are also microcontrollers with this capability, but the microcontroller uses the standard JTAG interface. JTAG is a standard (IEEE 1149.1) that is formulated for testing chips. The purpose is to use the four signals TCK, TDI, TDO and TMS to test the internal state of the chip. Why do we need to formulate a special standard for testing chips? This is because there are too many pins on complex chips, especially some chips that cannot see the pins once they are installed on a multi-layer circuit board, let alone measure them. At this time, the chip can be measured through the JTAG interface with the support of computer software. If the chips of various companies meet the standard, the JTAG ports of each chip can be connected in series (foreigners call it a daisy chain). No matter how many chips there are on the circuit board, only 4 pins are needed to measure all the chips on the circuit board. Since the chip can be measured, data can certainly be written into the chip. The JTAG interface is also used in the data download of programmable logic devices, and the concept of in-system programming (ISP) has emerged, that is, even if the programmable logic device is installed in the system, its internal circuit can be modified.
The progress of JTAG technology and EDA software has enabled the development and use of programmable logic devices to develop rapidly. Microcontrollers are also working in this direction. The C8051 microcontroller that appeared on the market a few years ago is a microcontroller using the JTAG interface. Unfortunately, the JTAG interface device and development software of the microcontroller are very expensive, which hinders people from using the microcontroller.
To use the JTAG port, an interface device must be connected between the computer and the chip JTAG interface. The device varies with the chip. In fact, the JTAG interface device is very simple (just a buffer), but because the early products of various companies do not fully support the JTAG interface, and the JTAG interface device must be compatible with these early products, the JTAG interface device becomes complicated.
At present, TI's MSP430 series chips are microcontrollers that support the JTAG interface. The company calls the JTAG interface device FET, and the microcontroller series can be programmed and simulated through FET. In particular, the interface is very simple and suitable for self-production. Many microcontroller enthusiasts on the Internet use self-made FETs to develop microcontrollers of this series, which is very successful.
(4) Experimental board
The experimental board is necessary for learning microcontrollers. The experimental board is also called a demonstration board or a target board. In fact, it is a circuit board with a microcontroller. Experimental boards can be purchased, and each microcontroller supplier provides a variety of experimental boards. Experimental boards can also be made according to needs. Making your own experimental board is challenging and requires learning to draw circuit board diagrams. [page]
(5) Select the type of microcontroller
Software: Supports C language and can be downloaded for free.
Emulator: The JTAG interface device used for simulation programming can be made by yourself (very important, which can save money). Microcontroller
: Many models, powerful functions, many resources, low power consumption, and large program memory capacity.
Materials: Many books and materials, especially online materials.
The only microcontroller that meets the above conditions is the MSP430 series.
5. How to learn microcontrollers
Learning is a process of meeting challenges and solving difficulties. Without challenges, there would be no fun in life.
The following uses the MSP430 series microcontroller as an example to explain the process of learning microcontrollers.
(1) Obtaining information
Purchase relevant books and obtain information from the Hangzhou Lierda Company website and the TI website. For example, you can find FET usage instructions, MSP430 F1xx series, F4xx series usage instructions and specific microcontroller chip data descriptions on the Internet. You can find a large number of practical application reference circuits such as simulator FET circuit diagrams, experimental board circuit diagrams, chip packaging knowledge, etc. Of course, some information is in English. It is a challenge to understand English information. Learning English at level 4 and level 6 is for reading information. English is difficult to learn, but reading information is easy. As long as you are determined and finish reading a book, you can understand all related information.
(2) Buying simulator FET and experimental circuit board
If you have good financial conditions, you can buy them directly.
(3) Making simulator FET and experimental circuit board
To make a simulator FET, you must first find the FET circuit diagram on the Internet, and then you can use the circuit board drawing software to draw the circuit diagram and circuit board diagram. This is another challenge. FET circuit is very simple, but it still takes some effort to make it. Find a relevant book and practice drawing schematics. After drawing the schematics, learn to understand component packaging and then buy components. Then you can draw the circuit board diagram. Once it is drawn, hand over the PCB file to the circuit board production company. After 10 days, you can get the circuit board, solder the components and cables, and after the experimental circuit board is ready, you can debug it together with the experimental circuit board. To make a
homemade experimental circuit board, you need knowledge of the internal working principle of the microcontroller chip, packaging knowledge, and a clear understanding of the function of each pin. You also need knowledge of digital tubes, buttons, resistors, three-terminal regulators, diodes, heat sinks, electrolytic capacitors, ordinary capacitors, resistors, toggle switches and other components. For beginners, you can make a simple experimental board with only 3 digital tubes, 8 buttons, and 8 light-emitting diodes. Although such an experimental board is simple, it is enough to help beginners get started with microcontrollers. Making a homemade experimental circuit board is the same as making a homemade FET. First draw the circuit diagram, then buy components, and then draw the circuit board. Since the MSP430 series chips are flat packages, it is difficult to solder them. This seems like a challenge, but it is actually very simple. The method is as follows: First, apply rosin water on the pad. When the rosin water is not dry, place the chip on the pad. Pay attention to the position of the first pin of the chip and align the pin with the pad. Touch the pin with a clean soldering iron (without any solder). As soon as the pin is hot, the solder on the pad will automatically solder the pin. Be careful not to have solder on the soldering iron. It is best to equip a magnifying glass when soldering. When soldering a circuit board, check the parameters of each component. Components that can be measured with a multimeter must be measured.
(4) Obtain IAR software from the Internet.
Download IAR software from the website of Lierda or TI and install it on the computer.
(5) Debugging FET and experimental board
Connect one end of the FET to the parallel port of the PC and the other end to the JTAG interface of the experimental board. After powering on, check whether the FET chip and the microcontroller chip on the experimental board are hot (use hand simulation), and whether the PC is working properly. Then run the IAR software, find an example of C language or assembly language, and download it to the microcontroller after successful compilation. If it can be downloaded, it means everything is successful. Otherwise, you still need to study it carefully. Generally, as long as the circuit on the circuit board is correct and the component parameters are accurate, there will be no failure.
(6) Learning microcontrollers in steps
Learning to use microcontrollers is to understand the hardware structure of microcontrollers, learn the initialization settings of various functions in assembly or C language, and program the realization of various functions.
Step 1: Use of digital I/O
Use buttons to input signals and light-emitting diodes to display output levels. You can learn the digital I/O function of the pins. After pressing a button, a light-emitting diode 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. Each time you use a function of the microcontroller, you need to 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 timers
. Once you learn how to use timers, you can use microcontrollers to implement timing circuits. The functions of timing circuits are powerful and have many applications in the control of industrial and household electrical equipment. For example, a microcontroller 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 2s, the light will turn off. Digital integrated circuits can implement timing circuits, programmable logic devices (PLDs) can implement timing circuits, and programmable controllers (PLCs) can also implement timing circuits, but only microcontrollers are the simplest to implement and have the lowest cost. 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 the 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 the 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), 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 the interrupt, you can compile a more complex structure program. Such a program 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 martial arts of the Eighteen Dragon-Subduing Palms. If you have learned three of the palms, you can barely protect yourself.
Step 4: Communicate with the PC via RS232.
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 the PC. The logic levels between them are different, and a MAX3232 chip is required 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, the RS232 interface programming of the PC, and so on. 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
the use of PCI, I2C interface and LCD interface. 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 the comparison, capture and PWM functions.
These functions can 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 10 moves of the 18th Palm of the Dragon, and you can attack.
Step 8: Learn the hardware and software design of the USB interface, TCP/IP
interface, and various industrial buses. Learning the hardware and software design of the USB interface, TCP/IP interface, and various industrial buses is very important because it is the current development direction of product development.
So far, it is equivalent to learning 15 moves of the 18th Palm of the Dragon, but it is not yet the realm of being invincible. Even so, it is also a microcontroller prawn. By the way, the technical support of the MSP430 microcontroller is very good. Responsible engineer prawns will stand up at the critical moment to save you from danger.
6. Reaching the ideal state
It is difficult to reach the ideal state. In the era of knowledge explosion, even if you study every day, it is difficult to keep up with the development of science and technology, not to mention that you have to find a job, get a professional title, write papers, get research funds, political studies, buy a house, buy a car, firewood, rice, oil, salt, sauce, vinegar, tea, etc. every day. So, do you still need to learn? The answer is yes. People live for interest. Only those who like single-chip microcomputers can learn single-chip microcomputers. Not for any purpose, just for the fun of learning. Of course, if interest can also make money, it is killing two birds with one stone.
Learning to use single-chip microcomputers is actually learning to use tools. At best, you are a craftsman who mends pots and bowls. If you want to make further progress, you need to work hard in signal recognition, control theory, digital signal processing theory, communication theory, etc. Only in this way can you develop high-level, high-value-added, intellectual property products and reach the highest level of proficient use of the Eighteen Palms of the Dragon Subduing, and be invincible in the world.
Single-chip microcomputers are the basis for the development of advanced hardware products such as DSP and embedded operating systems. If you want to develop further, you must learn the development of single-chip microcomputers.
If you learn the development of CPLD and FPGA and hardware description language on the basis of single-chip microcomputers, you can get a share in the development of high-speed products.
Previous article:Two ways of scanning the single chip matrix keyboard
Next article:MCU I/O port and addressing mode
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- EEWORLD University Hall ---- Intelligent Instrument Jilin University
- Inductors and Inductors
- MT7921 solution WIFI6 wireless network card driver compilation method
- How to choose external memory for DSP?
- What is an Operational Amplifier?
- [N32L43X Review] 5. SPI driver LCD 1.3 ST7789
- Is the MCU program running out of control again? Analysis of three types of running out of control phenomena
- Some understanding of convolution
- Ultra-low power MCU-how to select low power MCU
- Analog circuit behavior model and simulation based on Verilog-A_.pdf