Experimental environment : Keil software, version: C51 V9.54
STC-ISP comprehensive download software, version: V6.88
Simulation chip : IAP15W4K58S4
51 microcontroller online simulation environment construction
Step 1: Add the header files and simulation driver files of the STC microcontroller to the Keil software, and click Prepare to add;
Add STC microcontroller simulation file
Step 2: Select the installation location of the Keil software. Most of us have installed the Keil software for developing STM32. Remember to add it to the 51 microcontroller development environment folder, and then click "OK".
Select installation directory
After adding, a dialog box will pop up indicating that the addition was successful.
Add success dialog
Step 3: Open the Keil software to create a new project and check whether the addition is successful. When you create a new project, you can see "STC MCU Database"
There is STC microcontroller option
After selecting Database, you can see many STC microcontroller models.
STC microcontroller model
What I am using here is the IAP15W4K58S4 chip from Hongjing Company . Select the chip and click " OK "
Simulation environment settings
Step 1: Find the " Options for TARGET... " option and click
Step 2: Find the “ Debug ” option in the pop-up dialog box and select the “ STC Monitor 51 Driver ” option.
Select the good effect and click " OK "
Step 3: Click " Settings " to set the simulation port of the microcontroller
In the pop-up dialog box, select the USB-to-serial port. The port here is COM20 (choose according to your own serial port situation) , and the baud rate is 115200 (other baud rates are also available, you can choose according to your own situation), and set it up Then click the "OK" option
In this way, we have set up the development environment
Write code verification
Here we first use a program to turn on and off the LED light to test it.
First download it in the normal way and see the effect.
Before debugging, we should first perform a small operation on the simulated microcontroller, that is, download a monitoring program provided by ST Hongjing Company. Each of our STM32 microcontrollers comes with its own monitoring program. In the "STC-ISP" software Find "Keil Simulation Settings", then select our microcontroller model and click " Set the selected target microcontroller to the simulation chip "
In the Keil software simulation, we first set a breakpoint in the while loop. Since the communication speed of the serial port is not high, the simulation will easily crash if the delay time is too long. I will change the delay to 1ms here. You can try to change the serial port communication Try increasing the speed
Online simulation debugging effect
Summarize:
1. Simulation is a very important skill in the microcontroller learning process and project development process. It is said in the industry that the program is adjusted
2. Hongjing Company’s simulation microcontroller uses serial port simulation, so there are limitations on the data return speed. This requires some skills. Later, I will also introduce you to using proteus for online debugging and introduce some simulation skills, so please expect
Previous article:Can microcontroller debugging still be played like this? Keil and Proteus achieve perfect joint debugging of 51 microcontroller
Next article:Alternative entry methods and programming ideas for 51 microcontrollers
- Popular Resources
- Popular amplifiers
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
- 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
- How to isolate interference in the line
- Several ways of current sampling
- Free DIY PCB ruler
- ADI Prize Live Pre-registration | What to listen to in a traffic jam? New generation of in-car audio systems and software-defined cars
- Ceramic capacitor quick selection guide, do you know all this?
- Examples of several level conversion circuits
- Eliminating Software Failures with MSP432
- Single-button, double-button touch
- Does the IR21X series have a half-bridge driver chip with an output phase difference of 180°?
- BasicRF Simple Wireless Point-to-Point Transmission Protocol