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 online only supports 2K programs.
The development software for the PIC series is MPLAB. With the support of HI-TECH's C language support software PICC, the software is very easy to use, but PICC requires an activation password to run. The
development software for the MSP430 series is IAR, which has a full-featured limited version open for 1 month and a C language 4k support version, which shows 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 in old MCU because it does not have FLASH memory. New MCUs almost all have FLASH memory chips. Such chips support in-circuit programming (in-system programming). In-circuit programming means that the program can be written into the MCU using 3 to 5 wires, and the program running status, register contents and other information in the MCU can be transmitted to the PC. This programming method requires the installation of a simulation interface between the MCU and the PC, which generally needs to be purchased.
AT89S51 and PIC16F877 are MCUs with this capability. However, for beginners, the interface that supports the programming and simulation of the MCU needs to be purchased, and the simple interface will occupy chip resources during simulation, which brings inconvenience to the development of MCU systems.
The MSP430 series of microcontrollers also have this capability, but the microcontroller uses a standard JTAG interface. JTAG is a standard (IEEE 1149.1) developed for testing chips. The purpose is to use four signals, TCK, TDI, TDO and TMS, to test the internal state of the chip. Why do we need to develop a special standard for testing chips? This is because there are too many pins on complex chips, especially some chips that cannot be seen once they are installed on a multi-layer circuit board, let alone measured. 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 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 that uses 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 microcontrollers 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. [page]
(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.
(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, can save money). Microcontrollers
: 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. New microcontrollers all have a lot of resources. More resources can save external chips. Generally speaking, the number of chips in a system cannot exceed 5, otherwise the system will be a complex system. Speaking of the 51 series, when people first learned about the 31 chip, they must have an external program memory to work. To learn about the microcontroller, you must first learn about system expansion. Until now, many 51 books are still talking about the 31 chip and how to form the smallest microcontroller system. Such a smallest system has long been unused. As for the AT89S51 series, although it has a program memory, due to the small number of I/O and internal resources, it is rarely possible to form a single-chip system in practice. The reason why there are so many books about the 51 series is that a few years ago, there was only 51. Now it is different. Many new microcontrollers have powerful functions, many resources, and many I/Os, which can form a real single-chip system. The development software of these microcontrollers is well supported, the development simulator is cheap, and the power consumption is extremely low. The low power supply voltage is in line with the development direction of electronic devices. If you are also learning about microcontrollers, you should learn new and good ones. As for complexity, the 100+ instructions of the 51 series are more complex, and the number of instructions of MSP430 is less than half of that of the 51 series. Is it simpler? When learning microcontrollers, learn new ones. It is right to get tired of the old and love the new. (Some older people, due to laziness, do not learn new models. Don't learn from them. Teachers in schools are often like this, so there are many teachers teaching 51 in schools. The situation is changing in the past one or two years.) For example, the 5V system is a very mature system, but why do people use 3.3V, 2.5V, and 1.8V? This is because only low power supply voltage can reduce power consumption and improve integration. At present, many 5V devices are no longer produced. It is impossible to design products without new devices. Learning can be gradual. First learn the first function of the pin, then learn the second and third functions. With continuous efforts, you will be able to integrate them. In fact, learning the 51 series is also like this.
Low-cost emulators, open software, multiple chip I/Os, multiple internal chip resources, large program memory and RAM, and in-system programmability are issues that should be considered before learning microcontrollers. MSP430 basically meets these conditions.
Which model to learn is a matter of personal opinion, so you still have to make your own decision. 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 TI website. For example, you can find FET usage guides, MSP430 F1xx series, F4xx series usage instructions and specific microcontroller chip data 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, and 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 materials is easy. As long as you are determined and finish reading a book, you can understand all the relevant materials.
(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 simulator FET, you must first find the FET circuit diagram on the Internet, and then use the circuit board drawing software to draw the circuit diagram and circuit board diagram, which is another challenge. The FET circuit is very simple, but it still takes some effort to make it. Find a relevant book and practice drawing the schematic diagram. After drawing the schematic diagram, learn to understand the component package and then buy the components. At this time, you can draw the circuit board diagram. Once the drawing is completed, the PCB file will be handed over 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 completed, you can debug it together with the experimental circuit board.
To make a self-made experimental circuit board, you need to have knowledge of the internal working principle of the microcontroller chip, knowledge of packaging, and a clear understanding of the function of each pin. You also need knowledge of digital tubes, buttons, resistors, three-terminal voltage 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. The same as making a self-made experimental circuit board, 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 to be 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 electric soldering iron (without any solder). As long as the pin is hot, the solder on the pad will automatically solder the pin. Be sure to pay attention to the soldering iron. There should be no solder on the soldering iron. It is best to equip a magnifying glass when soldering. When soldering the circuit board, the parameters of each component must be checked. 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) Debug 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 touch), and whether the PC is working properly. Then run 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, it still needs to be studied carefully. Generally speaking, as long as the circuit on the circuit board is correct and the component parameters are accurate, there will be no failure.
(6) Learn microcontrollers step by step.
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 LEDs to display output levels, and 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 MCU 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 MCU is used, the register that controls the function must be set. This is the characteristic of MCU programming. Don't be afraid of trouble. All MCUs are like this.
Step 2: Use of timers
Learn how to use timers, and you can use MCUs 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 corridor light switch with a button can be implemented with a MCU. 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 2s, the light will turn off. Digital integrated circuits can realize sequential circuits, programmable logic devices (PLDs) can realize sequential circuits, and programmable controllers (PLCs) can also realize sequential circuits, but only single-chip microcomputers are the simplest to implement and have the lowest cost. The
use of timers is very important, and logic plus time control is the basis for the use of single-chip microcomputers.
Step 3: Interrupts
The characteristic of single-chip microcomputers is that a program is repeatedly executed, and 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 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 running 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, and what the program should do after the interrupt is completed, etc.
After learning interrupts, you can compile programs with more complex structures. Such programs can do one thing and monitor one thing. Once the monitored thing happens, it interrupts the thing being done and handles 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 martial arts of the Eighteen Dragon Palms. If you have learned 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 is required for level conversion.
The use of the USART interface is very important. Through this interface, the microcontroller and the PC can exchange information. 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 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. What an interesting thing it will be!
Step 5: Learn A/D conversion
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 voltage, current and other signals. When learning, pay attention to the concepts of 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 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 comparison, capture, 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 learn all the above seven steps, you can design a general application system, which is equivalent to learning the ten moves of the Eighteen Palms of the Dragon Subduing, and you can attack.
Step 8: Learn the hardware and software design of USB interface, TCP/IP interface, and various industrial buses.
Learning the hardware and software design of USB interface, TCP/IP interface, and various industrial buses is very important, because this is the development direction of current product development.
So far, it is equivalent to learning 15 moves of the Eighteen Dragon Palms, but it is not enough to be invincible. Even so, it is still a master of single-chip microcomputers. By the way, the technical support of MSP430 single-chip microcomputers is very good. Responsible engineer masters will step forward at critical moments to save you from danger.
6. Reach 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 scientific 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 as well as hardware description language on the basis of learning single-chip microcomputers, you can get a share of the pie in the development of high-speed products.
Reference address:Why do we need to learn 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 online only supports 2K programs.
The development software for the PIC series is MPLAB. With the support of HI-TECH's C language support software PICC, the software is very easy to use, but PICC requires an activation password to run. The
development software for the MSP430 series is IAR, which has a full-featured limited version open for 1 month and a C language 4k support version, which shows 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 in old MCU because it does not have FLASH memory. New MCUs almost all have FLASH memory chips. Such chips support in-circuit programming (in-system programming). In-circuit programming means that the program can be written into the MCU using 3 to 5 wires, and the program running status, register contents and other information in the MCU can be transmitted to the PC. This programming method requires the installation of a simulation interface between the MCU and the PC, which generally needs to be purchased.
AT89S51 and PIC16F877 are MCUs with this capability. However, for beginners, the interface that supports the programming and simulation of the MCU needs to be purchased, and the simple interface will occupy chip resources during simulation, which brings inconvenience to the development of MCU systems.
The MSP430 series of microcontrollers also have this capability, but the microcontroller uses a standard JTAG interface. JTAG is a standard (IEEE 1149.1) developed for testing chips. The purpose is to use four signals, TCK, TDI, TDO and TMS, to test the internal state of the chip. Why do we need to develop a special standard for testing chips? This is because there are too many pins on complex chips, especially some chips that cannot be seen once they are installed on a multi-layer circuit board, let alone measured. 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 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 that uses 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 microcontrollers 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. [page]
(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.
(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, can save money). Microcontrollers
: 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. New microcontrollers all have a lot of resources. More resources can save external chips. Generally speaking, the number of chips in a system cannot exceed 5, otherwise the system will be a complex system. Speaking of the 51 series, when people first learned about the 31 chip, they must have an external program memory to work. To learn about the microcontroller, you must first learn about system expansion. Until now, many 51 books are still talking about the 31 chip and how to form the smallest microcontroller system. Such a smallest system has long been unused. As for the AT89S51 series, although it has a program memory, due to the small number of I/O and internal resources, it is rarely possible to form a single-chip system in practice. The reason why there are so many books about the 51 series is that a few years ago, there was only 51. Now it is different. Many new microcontrollers have powerful functions, many resources, and many I/Os, which can form a real single-chip system. The development software of these microcontrollers is well supported, the development simulator is cheap, and the power consumption is extremely low. The low power supply voltage is in line with the development direction of electronic devices. If you are also learning about microcontrollers, you should learn new and good ones. As for complexity, the 100+ instructions of the 51 series are more complex, and the number of instructions of MSP430 is less than half of that of the 51 series. Is it simpler? When learning microcontrollers, learn new ones. It is right to get tired of the old and love the new. (Some older people, due to laziness, do not learn new models. Don't learn from them. Teachers in schools are often like this, so there are many teachers teaching 51 in schools. The situation is changing in the past one or two years.) For example, the 5V system is a very mature system, but why do people use 3.3V, 2.5V, and 1.8V? This is because only low power supply voltage can reduce power consumption and improve integration. At present, many 5V devices are no longer produced. It is impossible to design products without new devices. Learning can be gradual. First learn the first function of the pin, then learn the second and third functions. With continuous efforts, you will be able to integrate them. In fact, learning the 51 series is also like this.
Low-cost emulators, open software, multiple chip I/Os, multiple internal chip resources, large program memory and RAM, and in-system programmability are issues that should be considered before learning microcontrollers. MSP430 basically meets these conditions.
Which model to learn is a matter of personal opinion, so you still have to make your own decision. 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 TI website. For example, you can find FET usage guides, MSP430 F1xx series, F4xx series usage instructions and specific microcontroller chip data 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, and 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 materials is easy. As long as you are determined and finish reading a book, you can understand all the relevant materials.
(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 simulator FET, you must first find the FET circuit diagram on the Internet, and then use the circuit board drawing software to draw the circuit diagram and circuit board diagram, which is another challenge. The FET circuit is very simple, but it still takes some effort to make it. Find a relevant book and practice drawing the schematic diagram. After drawing the schematic diagram, learn to understand the component package and then buy the components. At this time, you can draw the circuit board diagram. Once the drawing is completed, the PCB file will be handed over 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 completed, you can debug it together with the experimental circuit board.
To make a self-made experimental circuit board, you need to have knowledge of the internal working principle of the microcontroller chip, knowledge of packaging, and a clear understanding of the function of each pin. You also need knowledge of digital tubes, buttons, resistors, three-terminal voltage 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. The same as making a self-made experimental circuit board, 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 to be 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 electric soldering iron (without any solder). As long as the pin is hot, the solder on the pad will automatically solder the pin. Be sure to pay attention to the soldering iron. There should be no solder on the soldering iron. It is best to equip a magnifying glass when soldering. When soldering the circuit board, the parameters of each component must be checked. 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) Debug 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 touch), and whether the PC is working properly. Then run 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, it still needs to be studied carefully. Generally speaking, as long as the circuit on the circuit board is correct and the component parameters are accurate, there will be no failure.
(6) Learn microcontrollers step by step.
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 LEDs to display output levels, and 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 MCU 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 MCU is used, the register that controls the function must be set. This is the characteristic of MCU programming. Don't be afraid of trouble. All MCUs are like this.
Step 2: Use of timers
Learn how to use timers, and you can use MCUs 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 corridor light switch with a button can be implemented with a MCU. 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 2s, the light will turn off. Digital integrated circuits can realize sequential circuits, programmable logic devices (PLDs) can realize sequential circuits, and programmable controllers (PLCs) can also realize sequential circuits, but only single-chip microcomputers are the simplest to implement and have the lowest cost. The
use of timers is very important, and logic plus time control is the basis for the use of single-chip microcomputers.
Step 3: Interrupts
The characteristic of single-chip microcomputers is that a program is repeatedly executed, and 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 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 running 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, and what the program should do after the interrupt is completed, etc.
After learning interrupts, you can compile programs with more complex structures. Such programs can do one thing and monitor one thing. Once the monitored thing happens, it interrupts the thing being done and handles 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 martial arts of the Eighteen Dragon Palms. If you have learned 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 is required for level conversion.
The use of the USART interface is very important. Through this interface, the microcontroller and the PC can exchange information. 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 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. What an interesting thing it will be!
Step 5: Learn A/D conversion
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 voltage, current and other signals. When learning, pay attention to the concepts of 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 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 comparison, capture, 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 learn all the above seven steps, you can design a general application system, which is equivalent to learning the ten moves of the Eighteen Palms of the Dragon Subduing, and you can attack.
Step 8: Learn the hardware and software design of USB interface, TCP/IP interface, and various industrial buses.
Learning the hardware and software design of USB interface, TCP/IP interface, and various industrial buses is very important, because this is the development direction of current product development.
So far, it is equivalent to learning 15 moves of the Eighteen Dragon Palms, but it is not enough to be invincible. Even so, it is still a master of single-chip microcomputers. By the way, the technical support of MSP430 single-chip microcomputers is very good. Responsible engineer masters will step forward at critical moments to save you from danger.
6. Reach 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 scientific 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 as well as hardware description language on the basis of learning single-chip microcomputers, you can get a share of the pie in the development of high-speed products.
Previous article:MCU system EMC test
Next article:Eight steps to learn microcontrollers
- Popular Resources
- Popular amplifiers
Recommended Content
Latest Microcontroller Articles
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- 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
MoreDaily News
- 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
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- 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)
Guess you like
- 【National Technology N32G430】Review ~ Light up the digital tube and serial port printing, ADC
- How to receive 0x00 in serial communication
- Take a look: Ulead Oscilloscope and Macosim Oscilloscope Actual Video (Transferred)
- EEWORLD University ---- Matlab Simulink Communication System Simulation
- OMRON EE-SPX613 working principle and action signal indicator
- Seeking to solve the USB interface interference problem of Explorer
- Prize Registration | Avnet invites you to participate in the 2022 International Industrial Expo! (November 30-December 4, Shanghai)
- LPS22 MakeCode extension (driver)
- [15th Anniversary] Points Exchange - The last round of chip currency exchange, chip points are officially launched!
- My EEWorld 2018 year-end summary @ [chat, laugh, make noise]