If you are still keen on using 51 MCU to make cars, drive LEDs, and make power supplies, then you are out of date. If you insist on using 51 until the resources are exhausted and then transform, you still have a long way to go. You must decisively give up using 51 MCU and take the first step towards being tall, rich and handsome. I personally think that MSP430 MCU is the second step to learn MCU. Now I will tell you why.
Look at the table below, the difference between MSP430F149 and STC89C52 is simply the difference between the evil American imperialism and the Mexican class brothers. Look at the ROM and RAM, one is a SAIC-GM-Wuling minivan, and the other is Optimus Prime. You should know that the larger the ROM, the larger the program that can be loaded, and the larger the RAM, the more data can be temporarily stored; look at the peripherals integrated on the chip, one is American equipment armed to the teeth, and the other is Xiaomi plus rifle, it is Xiaomi + rifle, not Xiaomi plus brand rifle; look at the power consumption mode and power requirements, a real man, no explanation.
Some people may complain about the price. Just look at the on-chip peripherals. If you use the STC89C52+ASIC combination, the price will probably be far more than 10 yuan. Some people may complain about the package. If I remember correctly, MSP430 also has DIP package.
The computing speed of msp430 is unmatched by 51 MCU. In addition, the hardware multiplier is integrated inside the MSP430, which greatly improves the computing speed. Msp430 is a low-power MCU, especially suitable for battery-powered devices. If you are going to develop low power consumption in the future, then msp430 and PIC are good choices. [page]
The 51 MCU is the easiest to learn, but its performance in all aspects is also very low. In actual applications, few people use 51 to develop products. If you want to develop higher-end MCUs, msp430 is a better choice. On the one hand, it allows you to involve low-power applications, and on the other hand, its functions and performance are close to ARM processors. Learning MSP430 well is a foundation for learning ARM in the future.
How to quickly get started with MSP430 microcontroller
The fastest and most effective way to learn MCU is to use a development board. When you buy a development board, the seller will send you relevant tutorials. I think you can get started quickly with a little practice.
I also went through this when I was learning MSP430. Now I share my experience with you and hope it will be helpful to you. How long does it take to jump from 51 microcontroller to msp430 microcontroller? I said it only takes one day. Even if you are not good at learning, you can get started in a week at most. Now I want to teach you a few tricks to help you quickly get started with MSP430 microcontroller.
The first move: Star Absorbing Technique
The Star Absorbing Technique is a martial art that can absorb the inner strength of others and use it for oneself. This martial art once dominated the martial arts world and was feared by the world. The types of microcontrollers cannot be counted with fingers and toes, and it is a bit difficult to count them with hair. If you want to learn the internal structure of each microcontroller, and then program and develop applications, it is something that only Crayon Shin-chan can do. So Gang Leader Ren developed the Star Absorbing Technique, which uses the experience of others as a means, and combined with his own practice, he can soon have a new martial art.
How do we apply the Star Absorbing Technique when learning MSP430 microcontroller?
Open your IE browser, go to Taobao homepage, search for MSP430 microcontroller development board, and you will see a lot of products, and most of them come with video tutorials and data sheets. These video tutorials can help you avoid many detours. First, you need to learn how to install IAR software, then how to set up the software and create a new project. This is the most basic skill. Follow it step by step, and you will find that using msp430 and 51 microcontrollers is almost the same, with its commonalities and differences.
To learn microcontrollers, you should try to reduce the time spent on addressing information and reading a lot of data manuals, and spend time on analyzing the program and memorizing the register settings. When you buy your development board, your seller has already sorted out the information for you, and given you tutorials and examples, so you just need to absorb them into your brain and turn them into your knowledge.
Star-sucking method - learn to use development boards and video tutorials to reduce detours as much as possible and spend more time on actual operations and development.
The second trick: transplanting flowers and trees
Transplanting flowers and trees is a martial art similar to the Star-Absorbing Art, but the difference is that it utilizes one's previously used martial arts and transfers them to new martial arts, instantly unleashing tremendous power.
As for the 51 MCU and MSP430 MCU, there are similarities and differences in the programming of the two MCUs. We can use the 51 MCU program and only need to modify a few letters, so that its program can be used as the MSP430 program. This method is called program transplantation. C language has strong portability. No matter what MCU it is, as long as it is programmed in C language, most of them can be transplanted to each other, but transplanting programs requires modularization of programs, otherwise transplantation will become more difficult.
51 Program modular transplantation msp430 example
Use 51 MCU and MSP430 to control two lights, one red and one green, and the two lights turn on and off alternately with a time interval of 0.5 seconds. Requirements: The program should be modular and can be easily transplanted
51 single chip microcomputer hardware circuit:
The anode of the red light is connected to the pull-up resistor, and the cathode is connected to the P1.0 pin of the microcontroller.
The anode of the green light is connected to the pull-up resistor, and the cathode is connected to the P1.1 pin of the microcontroller.
Msp430 microcontroller hardware circuit:
The anode of the red light is connected to the pull-up resistor, and the cathode is connected to the P2.0 pin of the microcontroller.
The anode of the green light is connected to the pull-up resistor, and the cathode is connected to the P2.1 pin of the microcontroller.
The red fonts are the differences in programming between the 51 MCU and the MSP430 MCU. The 51 MCU needs to declare the bit when using the IO port, for example, sbit P10 = P1^0; while the MSP430 MCU does not need to define the bit, but needs to set the IO direction, for example, P2DIR|= BIT0; to configure the P20 IO pin to output mode.
The MSP430 watchdog is turned on by default, so it should be turned off at the beginning of the program.
The blue font is the delay function. The delay function of each MCU is different, which depends on the time used by a single machine cycle of the MCU. Therefore, the delay function cannot be transplanted when transplanting the program. However, in order to facilitate the transplantation of other programs, the function names of the delay functions of two different MCUs need to be the same.
The delay function of the 51 single-chip microcomputer generally uses program delay, which is an inaccurate delay method.
In this article, the delay method of MSP430 uses the delay function in the MSP430 function library, __delay_cycles((long)(CPU_F*(double)x/1000.0)) to make precise delays. The user only needs to set the crystal oscillator frequency.
The bold black font is our application function. This application function is a portable module. The program of this module can be used directly without modification no matter where it is transplanted. This is the idea of modular program transplantation. This program can be applied not only to MSP430, but also to other microcontrollers, such as STM32.
Modular programs have the following characteristics:
1. P10 = 1; or P1OUT &=BIT0; cannot appear in the application function. These IO port configuration codes must be replaced by other terms. For example, #define Red_ON P10 = 0, we replace the P10 port on state with Red_ON.
2. Modular programs are usually described in English, for example, Red_ON means the red light is on. The meaning is very clear. One of the advantages of all modular programs is that they are easy to read and understand.
3. General IO configuration is usually defined by #define and stored in the header file or at the beginning of the program.
Previous article:Application of MC9S08QE4 microcontroller in active RFID
Next article:How to design wearable electronic products with MCU
Recommended ReadingLatest update time:2024-11-16 14:40
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- catkin_make does not compile all packages
- [Zero-knowledge ESP8266 tutorial] Quick start 22 Re-exploration of OLED module
- How to amplify the sound as much as possible when the sound source size is unknown
- Line regulation and load regulation
- Some cases of DSP program crash (flying away) - hardware reasons
- [Social Recruitment] [Campus Recruitment] China Electronics Technology Group Corporation Recruitment for Embedded Software Development
- EEWORLD University Hall----Live Replay: ON Semiconductor and Avnet IoT Innovation Design Competition Award Ceremony
- 【NXP Rapid IoT Review】+ Bluetooth (2 Use the computer's Bluetooth connection)
- Based on STM32F0+L6474 stepper driver open source sharing: source code + schematic + BOM table, etc. are all open source
- The product uses two dry batteries with a voltage of 3.2V. In order to prevent the batteries from being connected in reverse, MOS is used. From the simulation results, only...