Traditional single-chip microcomputer system development is always inseparable from simulators and programmers. With the rapid development of electronic and computer technology, single-chip microcomputer technology has also achieved unprecedented development. Some 16-bit single-chip microcomputers and 32-bit ARM microcontrollers are equipped with JTAG interfaces, which can be debugged and programmed online in a specified software integrated development environment through their own dedicated hardware tools. Some 8-bit single-chip microcomputers with integrated Flash memory and based on the MCS-51 enhanced core can be debugged and programmed online in a specified software integrated development environment through dedicated interfaces and unique dedicated hardware tools. If a single-chip microcomputer that can achieve online debugging and programming under a universal interface can be found among many single-chip microcomputers, it will be of great significance to simplify the development and further popularization of 8-bit single-chip microcomputer systems with the MCS-51 core.
NXP (formerly Philips Semiconductor) is the first company to obtain the MCS-51 technology license, and is also the company that has developed the most and most systematic MCS-51 core 8-bit microcontroller products. The P89V51RD2 microcontroller is a new generation of 8-bit microcontroller based on the MCS-51 core. It integrates 64 KB Flash program memory and 1 KB RAM data memory, and has self-debugging (SoftICE), in-system programming (ISP) and in-application programming (IAP) functions. These functions are all implemented under the RS-232 standard serial port. Using the P89V51RD2 microcontroller, you can use the KeilMonitor-51 Driver to directly connect to the system hardware to debug the program in the KeilμVision programming environment through the UART standard interface. After debugging, programming is performed under the FlashMagic tool software.
This article introduces the application ideas and methods of the latest technology of P89V51 RD2 in the development of single-chip microcomputer systems. This method can save the simulator and programmer required in the development of traditional single-chip microcomputer systems, improve the efficiency of program design in the development process, and enhance the software maintenance and upgrade capabilities of the final system.
1 Hardware circuit design of online debugging and programming functions
The circuit interface of the SoftICE and ISP functions of the P89V51RD2 microcontroller is relatively simple, but in order to be compatible with the in-system programming function of other Flash microcontrollers of NXP that can implement the ISP function at +5 V, the interface circuit schematic diagram for online debugging and in-system programming is shown in Figure 1.
In the circuit shown in Figure 1, the PC is connected to it through a standard serial communication line. When the SELECT switch connects the PSEN pin of the P89V51RD2 microcontroller to +5 V, the microcontroller is in normal working state; when the SELECT switch connects the PSEN pin to ground, the microcontroller is in ISP state, and the FlashMagic tool software performs online programming on the +5 V programmable Flash microcontroller.
2 Implementation of program debugging simulation
After activating the SoftICE function, the P89V51RD2 microcontroller can realize single-step simulation debugging, multi-step simulation debugging and simulation debugging under full-speed operation. Simulation debugging is mainly divided into three steps: activating the SoftICE function of the P89V51RD2, setting the hardware simulation environment and debugging the program.
2.1 SoftICE Function
The activation of SoftICE function requires the support of FlashMagic software, which can be downloaded from NXP or other related websites. Currently, the highest version of FlashMagic that supports 51 MCU is V3.54, which is mainly used to support NXP's ARM devices and does not support the company's 51 devices.
In the single-chip microcomputer application system containing the interface circuit shown in Figure 1, first use the SELECT switch to connect the PSEN pin of the single-chip microcomputer to +5 V, then start the FlashMagic software, and configure the parameters in the main interface as follows: COMPort - depends on the specific connection, usually COM1 or COM2; BaudRate - 9 600, which is determined by the internal firmware of P89V51RD2; Device - P89V51RD2; Interface - None (ISP). Select the "Enable SoftICE" command item under the ISP menu to activate the SoftICE function.
2.2 Setting up the hardware simulation environment
The compilation and simulation of the microcontroller application system program is carried out in the KeilμVision environment. Before debugging the program, you need to set up the project for debugging and choose software simulation or hardware simulation. Software simulation uses a computer to simulate the operation of the program, and certain operation results can be quickly obtained without building a hardware platform; hardware simulation is the most accurate simulation method. A hardware platform must be established, and the system is debugged through PC → hardware simulator → user target system. Using the hardware simulation method, the hardware platform is the microcontroller application system with the interface circuit shown in Figure 1. The specific steps for setting up the hardware simulation environment are as follows:
First, click on the created project: Options for Target'Target 1' in the Project menu, the project configuration window will appear, click on Debug settings, select KeilMcmitor-51 Driver, and the specific parameter settings are shown in Figure 2.
Then, set the simulator parameters. The recommended baud rate setting range is 300 to 38 400. To avoid conflicts between interrupts in the program and interrupts in the Keil hardware simulation environment, do not select "Stop Program Execution with Serial Interrupt". The simulator parameter settings are shown in Figure 3.
After completing the activation of the SoftICE function of the P89V51RD2 microcontroller and the hardware simulation environment setting in the Keil μVision environment, you can debug and simulate the program.
3 Implementation of In-System Programming
When the MCU with SoftICE function activated completes the program debugging, the final program code can be downloaded to other Flash MCUs with ISP function of NXP. It should be noted here that only the P89V51RX2 series MCU that has not activated the Soft-ICE function supports the ISP function, because the MCU with SoftICE function activated has cancelled the ISP function. The in-system programming of P89V51RX and P89LV51RX series MCUs is relatively simple. You only need to make the settings as shown in Figure 4 on the FlashMagic main interface, and click the Start button in the figure to complete the programming of the MCU. After completing the programming, press the system reset button, and the MCU application system can run normally.
In addition to the above two series, NXP also launched the P89C51Rx2Hxx, P89C51Rx2xx, P89C60X2/61X2 and P89C66x series of Flash microcontrollers. These microcontrollers can be programmed in the system using the interface circuit shown in Figure 1. However, when programming, the PSEN pin of the microcontroller needs to be grounded through the SELECT switch so that the microcontroller can directly enter the ISP state after reset, and then the above programming can be performed. When using these series of microcontrollers for online programming, you should also pay attention to the setting of the boot vector (BOOT VECTOR) and the status word (STATUS BYTE). For specific details, you can refer to the user manual of the specific model of the microcontroller.
4 P89V51RD2 MCU Application System Development
The following takes the P89V51RD2 MCU in the PTZ controller design as an example to introduce the whole process of system development. The development process of the MCU application system using P89V51RD2 is shown in Figure 5.
① System requirements analysis. Through on-site investigation and communication with users, comprehensively, deeply and accurately analyze the functions, application environment, application objects, application process and specific requirements of the PTZ controller, and draw the overall goals of the PTZ controller and the functions, specific tasks and product forms of the system, and finally form a requirements analysis report.
② Design scheme. Based on the demand analysis, carry out system scheme design and determine the specific technical scheme of the single-chip microcomputer application system. Including: system performance design, function design, working principle design, software structure design, program flow design and communication protocol design.
③ System hardware design. Design the system hardware according to the system performance and the functions to be realized. At this time, consider integrating the interface circuit shown in Figure 1 into the system hardware to prepare for the use of P89V51RD2 for online program debugging and simulation.
④ Software programming and online debugging: Modular program design is carried out according to the software structure design, program flow design and communication protocol design, and the P89V51RD2 microcontroller with SoftICE function activated is connected to the system hardware for online program simulation debugging.
⑤ Select the MCU model. According to the system software program that has passed the hardware debugging, estimate the code space occupied by the program and select the appropriate model from the many Flash MCUs launched by NXP.
⑥ Single-chip microcomputer programming. Online programming of the selected single-chip microcomputer.
Conclusion
In the development of single-chip microcomputer system, the use of single-chip microcomputer with self-debugging and in-system programming functions is of great significance to reducing system development costs, accelerating the development process, and improving system maintainability. This article introduces the ideas and methods of applying NXP's new generation of single-chip microcomputer P89V51RD2 in single-chip microcomputer system development, which has a good reference value for designers who have adopted or are about to adopt NXP's Flash single-chip microcomputer.
Previous article:Design and implementation of contactless IC card water-saving controller
Next article:Design of Solar Energy Environmental Parameters Tester Based on AT89S52 Single Chip Microcomputer
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
- Regarding the situation where OBD multi-frame transmission fails to receive data
- Selling simulink models and TI28335 programs
- Infrared alarm circuit diagram
- EEWORLD University ---- Huawei IOT Internet of Things Tutorial
- [TI recommended course] #[High Precision Lab] ADC Series 5: ADC Frequency Domain Indicators#
- Please provide the equation for the LC series resonant circuit plus a rectangular wave, thank you.
- GD32E230C Display Variables
- I would like to ask about the LCD configuration of Imx6ull
- Arduino - 315/433MHz RF Wireless Transceiver Module
- Design of semiconductor laser power supply for intelligent control