The programming of MCS-51 microcontroller is usually divided into the following three steps:
1. Make a program flow chart
Find the most reasonable and simplest solution for the proposed algorithm and make a program flow chart. The program flow chart shows people's ideas of using a certain algorithm to solve the problem. There are two types of flow charts: rough and detailed. The rough flow chart can give the general steps of solving the problem, while the detailed flow chart gives the details of each step. For some big problems, a rough flow chart should be given first to get the overall concept, and then a detailed flow chart should be made to give a specific description of each step.
2. Resource allocation
Reasonably allocate system resources according to the requirements of the algorithm, such as memory allocation, input and output interface allocation, etc. In the MCS-51 system, program and data memory are addressed separately, and the memory is divided into internal and external memory, and there is also bit-addressed memory. Therefore, reasonable resource allocation will bring convenience to programming, otherwise it may increase trouble and even cause program errors.
3. Source Programming and Debugging
Source programming is to implement the algorithm expressed in the flow chart with a program. The program of the MCS-51 system can be edited with an editor, read in the integrated debugging environment, or directly input in the integrated debugging environment. The integrated debugging environment includes debugging tools for the program, such as single-step, breakpoint, full-speed program running, and register checking, memory content checking and other functions.
Among the above steps, making a program flow chart is an important step in program design. In complex problems, it can help designers find the best solution and reduce errors in the source program writing process; it can also help find errors in the debugging process. It is also a concise explanation of the source program, which is easy to retain and communicate. Usually we should make a program flow chart first and then compile the source program.
Previous article:Design of MCS-51 Single-Chip Microcomputer System Program
Next article:The role of pull-up resistor in 51 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
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- FAQ_ How to choose a high-speed crystal for BlueNRG-x
- 2021 STMicroelectronics Industry Summit Tour- Shanghai/Beijing
- Summary: RCSN Play Anxinke's new esp32s3 development board
- How should Japan deal with nuclear waste water? Give us some ideas
- RTL diagram timing, can anyone help me explain why the two outputs in this diagram are in the two-choice mode?
- Now DCDC design tools are made like this
- The disappearing boundary between MCU and MPU
- DS18B20 STM32G474 driver
- 【Fudan Micro FM33LC046N】Clock output test
- Python Basics: Dictionary Application