2. Use unsigned data types as much as possible (8051 microcontrollers do not directly support signed data types. Signed operations require additional instructions to support them, but unsigned data types can be directly supported by 8051)
3. Choose the smallest storage mode possible, that is, small (most applications can be satisfied with the small storage mode, or the large storage mode. If some arrays and structures are stored in the xdata or pdata storage space, choose the extremely large storage mode. Note that the basic pointers used by the Keil C51 real-time library can work in any storage mode)
4. When applying other storage modes, store variables in the data area as much as possible (store variables in the data space, this part of the space can be directly accessed by the MCU, and has the highest execution efficiency. Usually this area stores the most efficient code) Local pictures, please re-upload
5. Know how to use PDATA storage mode on your device (pdata provides 256 bytes of space, using MOVX @Ri instruction to access 8-bit addresses. The use of pdata storage space is different from the internal devices of 8051 microcontrollers, and the page register needs to be set. Xdata storage type is universal and can achieve a maximum storage space of 64kb)
6. Use memory type pointers as much as possible (by default, the Keil C51 compiler uses general pointers to access any type of memory space, and memory type pointers can only access fixed storage space, but this method can generate faster and smaller program code)
7. Reduce the use of reentrant functions (the 8051 series lacks support for stack variables. The implementation of reentrant functions is achieved by the Keil C51 compiler using a compile-time stack to overwrite the data content within the memory range. The reentrant function simulates the stack structure on the 8051 microcontroller. Since reentrant function code is rarely used in embedded applications, you should use this reentrant property as little as possible during the design process)
8. Use LX51 Linker/Locate and Linker code packing to reduce the size of your program. (LX51 Linker/Locate analyzes and optimizes your entire program. The code will be rearranged in memory, using 2-byte AJMP and ACALL instructions to replace 3-byte LJMP and LCALL instructions. Linker code packing uses common code segments to generate subroutines)
9. Keep the interrupt function as short as possible (a well-structured interrupt function only performs data acquisition or timing, and data processing is completed in the main function or the task function of the real-time system, which can effectively reduce the calls of interrupt functions involving saving/storage)
10. Check the need for clock cycles (code access to data requires a certain period of time, especially in real-time systems using multiple threads or interrupt service routines that need to be in the main function)
Previous article:51 MCU Tuoji 955 Test
Next article:The simplest program of PID control algorithm for single chip microcomputer
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- ASML predicts that its revenue in 2030 will exceed 457 billion yuan! Gross profit margin 56-60%
- Detailed explanation of intelligent car body perception system
- An SI engineer who does not understand processing cannot be called Mr. High Speed
- EEWORLD University Hall----Live Replay: Use ModusToolbox? to build a system to flexibly respond to IoT design challenges
- Why is the square wave voltage generated by the inverter circuit measured using the AC voltage range of a digital multimeter much smaller than the theoretical value?
- Design of three-coordinated distributed control system based on TMS320F2812 DSP
- Several ways to accurately delay the microcontroller
- Application Development Notes | Mir MYD-YA15XC-T LoRa Wireless Communication Example
- Advanced Driver Assistance System Solution Series Introduction—Digital Camera
- Prize-winning quiz | ADI application tour - water quality and gas monitoring
- #The best content of the "Interview with famous teachers" in the Electronic Competition#The second issue - Professor Chen Nan from Xidian University
- CH563 implements remote file management system based on FTP