Steps to Implement Online Debugging with KEIL

Publisher:csZhouLatest update time:2018-12-15 Source: eefocusKeywords:KEIL Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

In addition to writing, compiling and simulating execution to debug user programs, Keil can also implement online debugging through the serial port, that is, to see the execution effect of the code on the hardware through single step and breakpoint. The steps are as follows:


The AT89C51CC03 microcontroller is used, and the keil version is Keil C51 V9.00.


1. Use KEIL to create project files, program, compile and debug user programs to ensure that there are no problems in software execution.


2. Modify the configuration file config.inc in the keil/c51/FlashMon directory of the KEIL installation point that is consistent with the microcontroller model. Mainly modify the two parameter values ​​of cpu_clock and code_start according to the actual situation. I changed them to 12M and 0E000H.


3. Recompile the programs in this directory and generate a new debugging program Monitor.HEX. If it is not regenerated, check the option create HEX file.



4. Run the FLIP program and burn Monitor.HEX into the MCU. The starting address is 0E000H, that is, SBV=E0, BLJB is selected, BSB=0, EB=FF


5. Click the Start Application button to execute the Monitor.HEX program


6. Run Keil, open the project file, modify the debugging parameters, that is, menu project-->option for target, select debug page, click use Keil monitor 51 driver on the right, click the setting button, select the serial port and baud rate, note that it should be consistent with the baud rate used when burning the chip, generally 9600. It should be noted that if the serial port is in automatic mode (that is, in addition to the three communication lines, RTS and DTR are also connected), RTS and DTR need to be set to inactive.



7. After compiling the program, click the debug command under the debug menu. You can execute it step by step, set breakpoints, and run it at full speed. At this time, you can actually use the microcontroller hardware to run the program and see the execution effect, such as display, key response, etc. In this case, you can debug the actual execution effect of the program.


8. If you do not set breakpoints and run the user program at full speed, the user program will be consistent with the actual operation, Keil will lose control of the user program and will not be able to interrupt the execution of the user program (only pressing reset can interrupt the user program)


9. If you find a problem, you can exit the debugging state, modify the program, recompile, and then enter the debugging state again, and debug by single-step or setting breakpoints. Note that you cannot interrupt when running at full speed, otherwise you will not be able to exit (the consequence of forced exit is that the monitor state is incorrect and you cannot enter the online debugging state again).


10. After exiting debugging, the monitor program cannot be executed again, whether you press reset or flip the program's start application button. At this time, the user program is executed. If you want to continue debugging, you can only erase the flash and burn the monitor into the microcontroller again.


Keywords:KEIL Reference address:Steps to Implement Online Debugging with KEIL

Previous article:STM32 RAM download online debugging settings
Next article:STM32 sets the DEBUG start address in keil

Recommended ReadingLatest update time:2024-11-23 02:59

Xintang N76E003 MCU downloads program and downloads pin multiplexing in Keil
1. Install other drivers related to the downloader, and then download them using the download tool. 2. Open Keil and plug in the downloader. You will be prompted to upgrade the firmware. Just agree to it. Finally, you need to unplug and plug it in again, and then select in Keil: 3. Click "Settings" and set as shown
[Microcontroller]
Xintang N76E003 MCU downloads program and downloads pin multiplexing in Keil
Introduction to 51 MCU - Use of Keil uVision4
Preface For MCU programs, each functional program must have a matching project, even if it is a particularly simple functional program. Therefore, we must first learn how to use the software to create a project file. 1.What is Keil uVision4? Keil uVision4 is a microcontroller-compatible software development system.
[Microcontroller]
Introduction to 51 MCU - Use of Keil uVision4
Use KEIL's software-emulated logic analyzer function to observe the GPIO waveform
In daily work, logic analyzers and oscilloscopes are indispensable tools for MCU engineers. Sometimes when there are bugs in the program, these tools are needed to view the waveform, so as to locate the problem more quickly and solve the problem. But in addition to the cost, it is impossible for us to carry these to
[Test Measurement]
Use KEIL's software-emulated logic analyzer function to observe the GPIO waveform
How to migrate KEIL4 project to KEIL5 program
Due to the differences between KEIL4 and KEIL5 programs, KEIL5 cannot directly open KEIL4 projects. However, in order to ensure the downward compatibility of KEIL5, ARM provides us with two ways to be compatible with KEIL4 programs. First, we use keil5 to open the keil4 project, and the following window will pop up.
[Microcontroller]
How to migrate KEIL4 project to KEIL5 program
There is a problem with setting a breakpoint on a line of the keil4 program. Double-clicking the line where the program is located does not respond.
Recently I need to use keil4 to set breakpoints and test the delay time of the microcontroller, and I found that double-clicking the line where the program is located has no response. solution: 1. Open the Keil software and select Source Group 1 2. Right-click Source Group 1 3. Select Options for Group 'Source
[Microcontroller]
How to calculate delay using Keil
  Some friends are asking how to calculate the operation time in C language. Now I will give a simple example to illustrate. figure 1   If we want to calculate for(b=0;b Figure 2: Opening the Project Settings window image 3   After setting up, set two breakpoints before a
[Microcontroller]
How to calculate delay using Keil
ARM DS-5 development of STM32 program (Eclipse with Keil plug-in)
ARM DS-5 is an ARM development environment based on Eclipse. It has a complete compilation process and works better with Keil plug-ins to develop STM32. Without further ado, let me introduce the idea first: 1. Install the MDK software, and you will have the tool chain for compiling STM32. I use MDK 4.72.  http://pan
[Microcontroller]
ARM DS-5 development of STM32 program (Eclipse with Keil plug-in)
Compile Keil MDK project in Eclipse
Recently, I have been playing with ARM7 in my spare time, using Keil uVision integrated development environment. Sometimes I can't stand it. The code prompt/highlight function of the editor is almost zero. The code basically needs to be typed in one letter at a time! Think about how comfortable it is to develop in VS,
[Microcontroller]
Compile Keil MDK project in Eclipse
Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号