Learning microcontrollers----what should we do?

Publisher:幸福约定123Latest update time:2017-04-04 Source: 21icKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Single-chip microcomputer is a common course for electrical 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? There are many professional courses in electrical majors. These professional courses are very important and are necessary courses for all majors. After learning these courses, learners can become the successors of university scholars. The market demand for the successors of scholars is too small. What is needed in large quantities are product developers. Product development requires practical work and development tools, and single-chip microcomputer courses are courses for learning how to use development tools. Learning single-chip microcomputer courses is different from theoretical courses. You can't just do homework, but you have to actually use single-chip microcomputers. The following is a brief description of some immature ideas on how to prepare for the conditions and learning steps of learning single-chip microcomputers.

1. Hardware

(1) Programming hardware

Programming is to burn the program running on the microcontroller into the memory of the microcontroller. Currently, most microcontrollers use FLASH memory, which can be written about 1,000 times, but can also be written 10,000 times 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, it 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 emulator can be one device or separate 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 programs into the microcontroller.

(2) Real-time simulation software

This software can debug the microcontroller program with the support of the simulation interface.

(3) Virtual Simulation

This type of software supports microcontroller program debugging without microcontroller hardware.

(4) Support C language

All microcontroller development software supports assembly language programming, but people currently prefer C language programming, mainly because C language is powerful and can shorten development time.

There is currently software that supports the above functions, such as Keil 51 for the 51 series, MPLAB for the PIC series, IAR for the MSP430 series, etc.

3. Means of learning microcontrollers

According to economic strength, the means of learning microcontrollers are divided into the following categories:

(1) Buy a book on microcontrollers and study it carefully.

(2) Download a MCU development software with simulation function (preferably supporting C language) from the Internet and virtually simulate the MCU on the computer.

(3) Purchase a programmer (software that supports the programmer is provided by the programmer vendor) and an experimental board (also called a demonstration board or target board), and download the development software online. With the support of the development software, virtually simulate the microcontroller. After confirming that the microcontroller program is correct, use the programmer to download the program to the microcontroller and observe the actual operation of the program.

(4) Purchase simulation interface and experimental board, download MCU development software (support programming, virtual simulation,

Real-time simulation and C language), after the virtual simulation is completed, the program is downloaded to the microcontroller for real-time simulation.

For individuals who want to learn microcontrollers, having the above conditions (4) is already very good.

4. Troubles in the process of learning MCU

There are many types of microcontrollers. The microcontrollers, development hardware, software functions, and prices provided by different companies are all different, which can cause a lot of confusion for beginners of microcontrollers.

(1) MCU problem

There are many single-chip microcomputers at present. You can learn any one of them. 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 others. 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 decent hardware support, especially the AT89 series of Atmel's products. Many people became rich by studying this microcontroller.

AVR90 series is also a product of Atmel. It has few instructions, is easy to learn, has many types of chips, and is suitable for various occasions and needs. According to relevant information, the number of this microcontroller chip in use is very large, and there is a trend of exceeding the number of 51 series chips.

PIC series is a product of Microchip Corporation. It has 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 program, it provides free development devices and experimental boards. As a result, the number of people using this chip has increased greatly. It is also a microcontroller that can compete with the 51 series microcontrollers.

The MSP430 series, a product of TI, is a 16-bit, ultra-low power microcontroller that is particularly suitable for the development of low-power devices such as handheld devices. In fact, due to the large number of pins and internal resources (with hardware multipliers), this series is useful in the development of many products. According to relevant sources, this series is the most promising microcontroller.

There are many other microcontroller models, but I dare not comment on them because I don’t know much about them. However, I can imagine that they must be good microcontrollers, otherwise they would not exist in such a competitive market.

(2) Software development issues

Different types of microcontrollers are equipped with corresponding development software, many of which are developed by professional software companies.

51 series, the current development software is Keil 51, the software 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-time version open for one month and a C language 4k support version. This 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 that microcontroller. Microcontroller providers are well aware of this, so more open versions of the software can often be found on the Internet.

(3) Simulation interface

The simulation interface, also known as the simulator, is very difficult to program in simulation because the old MCU does not have FLASH memory. Almost all new MCUs have FLASH memory chips, which support in-circuit programming (in-system programming). In-circuit programming means that the program can be written into the MCU with 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 microcontrollers with this capability. However, for beginners, an interface that supports programming and simulation of the microcontroller needs to be purchased, and the simple interface will occupy chip resources during simulation, bringing inconvenience to the development of the microcontroller system.

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 the four signals TCK, TDI, TDO and TMS to test the internal state of the chip. Why do test chips need to have a special standard? 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 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, of course data can be written to the chip. The JTAG interface is also used in the data download of programmable logic devices. 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 advancement of JTAG technology and EDA software has led to a rapid development in the development and use of programmable logic devices. Microcontrollers are also working towards 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 this 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). However, since 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 single-chip microcomputers that support the JTAG interface. The company calls the JTAG interface device FET, and the FET can be used to program and simulate the series of single-chip microcomputers. In particular, the interface is very simple and suitable for self-production. Many single-chip microcomputer enthusiasts on the Internet use self-made FETs to develop this series of single-chip microcomputers, which is very successful.

(4) Experimental board

Experimental boards are necessary for learning microcontrollers. Experimental boards are also called demonstration boards and target boards. In fact, they are circuit boards with microcontrollers. Experimental boards can be purchased, and various microcontroller suppliers provide a variety of experimental boards. Experimental boards can also be made by yourself according to needs. Making your own experimental boards is challenging and requires learning to draw circuit board diagrams.

(5) Select the MCU type

Software: Support C language, free download.

Emulator: The JTAG interface device used for simulation programming can be made by yourself (very important, can save money).

Single-chip microcomputer: multiple models, powerful functions, abundant resources, low power consumption, and large program memory capacity.

Information: There are many books and information, especially online.

The only microcontroller that meets the above conditions is the MSP430 series.

5. How to learn microcontrollers

Learning is the process of meeting challenges and solving difficulties. Without challenges, there would be no fun in life.

Below, taking the MSP430 series microcontroller as an example, we will explain the process of learning microcontrollers.

(1) Obtaining information

Buy relevant books and get information from the 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 simulator FET circuit diagrams, experimental board circuit diagrams, chip packaging knowledge and a large number of practical application reference circuits. 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 information is easy. As long as you are determined and finish reading a book, you can understand all relevant information.

(2) Purchase simulator FET and experimental circuit board

If your financial situation is good, you can buy it directly.

(3) Homemade simulator FET and experimental circuit board

To make a self-made 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, 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 electric soldering iron. It is best to equip a magnifying glass when soldering. When soldering a circuit board, the parameters of each component must be checked, and components that can be measured with a multimeter must be measured.

(4) Obtain IAR software from the Internet

Go to TI's website to download the IAR software and install it on your computer.

(5) Debugging FET and experiment 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, it 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 MCU step by step

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

Step 1: Use of Digital I/O

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

Step 2: Use the timer

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

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

Step 3: Interrupt

The characteristic of a single-chip microcomputer is that a program is repeatedly executed, 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-occurring things, such as the falling edge when a button is pressed. In order for the single-chip microcomputer to 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 and processes the fast action. After the processing is completed, it returns to execute the normal program. The difficulty in using the interrupt function is that it is necessary to accurately know when to not allow interrupts to occur (mask interrupts) and when to allow interrupts to occur (enable interrupts), and which registers need to be set to enable a certain interrupt function.

What kind of interrupt takes effect, what the program should do when the interrupt starts, what the program should do after the interrupt is completed, and so on.

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

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

Step 4: RS232 communication with PC

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

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

Step 5: Learn A/D conversion

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

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

Step 6: Learn PCI, I2C interface and LCD interface

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

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

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

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

Step 8: Learn the hardware and software design of USB interface, TCP/IP interface, and various industrial buses

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

So far, it is equivalent to learning 15 moves of the 18 Dragon Subduing 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 engineers will step forward at the critical moment to save you from danger.

6. Achieve 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 promotion, 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 study? The answer is yes. People live for their interests. Only if you like microcontrollers can you learn microcontrollers, not for any purpose, just for the fun of learning. Of course, if your interest can also make money, it will kill two birds with one stone.

Learning to use a single-chip microcomputer is actually learning to use a tool. At best, you are a craftsman who can mend 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 being proficient in using the Eighteen Dragon Palms and being invincible.

The single-chip microcomputer is the basis for the development of advanced hardware products such as DSP and embedded operating system. If you want to develop further, you must learn the development of single-chip microcomputer.

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.


Keywords:MCU Reference address:Learning microcontrollers----what should we do?

Previous article:What is the essential difference between PLC and microcontroller?
Next article:APS Microcontroller Review Guide

Recommended ReadingLatest update time:2024-11-16 13:25

Design of Temperature Monitoring System Based on Single Chip Microcomputer
introduction Temperature detection is one of the important working conditions in many industries. Whether it is a grain warehouse, a Chinese medicine warehouse, or a book storage, it needs to be in a temperature environment that meets the specified conditions. However, temperature is the most difficult ind
[Microcontroller]
Design of Temperature Monitoring System Based on Single Chip Microcomputer
Design of car grille scanning light based on 51 single chip microcomputer
0 Introduction The rapid development of the LED industry has brought a great impact on lighting and decoration, especially the combination of LED and automobiles is a hot topic at present. LEDs are gradually appearing in the reading lights, width lights, brake lights, and even headlights in cars. Of course, as
[Microcontroller]
Design of car grille scanning light based on 51 single chip microcomputer
NXP i.MX RT MCU technology empowers the future of smartwatches
  With the rapid advancement of technologies such as enhanced processor performance, longer battery life, more ubiquitous connectivity, smarter sensing, monitoring and tracking, and more user-friendly interfaces, wearable devices have been vigorously developed, while products are smaller in size and lower in cost.
[Internet of Things]
NXP i.MX RT MCU technology empowers the future of smartwatches
Introduction and examples of 51 single-chip microcomputer unconditional transfer instructions
Unconditional transfer instructions   (1) Short transfer instructions  AJMP addr11  (2) Long transfer instructions  LJMP addr16  (3) Relative transfer instructions  SJMP rel  If you analyze the above three instructions carefully, you will find that they are quite different. However, when you start learning, you
[Microcontroller]
MCU memory configuration
MCU memory configuration: On-chip RAM 128 bytes (00H-7FH); The first 32 units of the on-chip RAM are the working register area (00H-1FH) The on-chip RAM has 128 bit-addressable bits, occupying 16 cells. The bit address number is: 00H-7FH, distributed in 20H-2FH units (P.27) Among the 21 special function re
[Microcontroller]
MCU memory configuration
The structure of MCS-51 series microcontroller
    The basic product models of the MCS-51 series: 8051, 8031, and 8751 are called the 51 sub-series, and are packaged in a 40-pin dual in-line package. The CPU processing power and instruction system of different models of MCS-51 microcontrollers are fully compatible, but the configuration of the memory and I/O interf
[Microcontroller]
The structure of MCS-51 series microcontroller
Can Tesla drive the new energy vehicle market back to health?
The automotive semiconductor market is becoming one of the most promising semiconductor application markets. Especially driven by Tesla, the market penetration rate of new energy vehicles will continue to increase rapidly, bringing huge market demand and industrial opportunities to domestic semiconductor manufacturers
[Embedded]
Can Tesla drive the new energy vehicle market back to health?
The Principle and Design of Intelligent Power Cabinet Using Single-Chip Microcomputer C8051F060
1. Introduction At present, domestic excitation power cabinets generally have problems such as incomplete detection functions, backward information transmission technology, control and detection technology. In order to solve this problem, this paper presents a communication method between the intelligent excita
[Microcontroller]
The Principle and Design of Intelligent Power Cabinet Using Single-Chip Microcomputer C8051F060
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


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

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