Operations in Keil C Debugging State

In the debugging state of Keil C, how can we observe the operating status of various internal and external peripherals? How can we modify their settings?

Answer: In debugging state, click on different peripheral options under the Peripherals menu to display or hide the corresponding observation windows. For example, to display the Timer 0 window, click on the Timer option under the Peripherals menu, and the timer/counter 0 status window will be displayed.

During program execution, the status of various internal and external peripherals changes continuously. To observe these changes at any time, you can enable the Periodic Windows Update command under the View menu, which allows Keil C to automatically refresh each debugging window periodically. Additionally, you can directly set the device in the window, just like the command settings in the program, and it will take effect immediately.

In the debugging state of Keil C, how can we observe and modify variables?

Answer: In debugging state, click on the Watch & Call Stack Window command under the View menu or the corresponding button to display or hide the variable window. The variable window contains four tabs, which can display local variables (Locals tab), specified variables (Watch #1 and Watch #2 tabs), and the call stack (Call Stack tab).

In the local variables area, the variables of the current function are displayed automatically without the need for any settings. To observe other variables, you can press F2 and enter the variable name in the Watch #1 or Watch #2 tabs. During program execution, you can observe the changes of these displayed variables, and you can also modify their values by clicking with the mouse.

There is also a simpler way to observe the value of a variable. When the program is stopped, hover the cursor over the variable you want to observe for about one second, and the current value of the corresponding variable will appear, such as operate=0x32.

In the debugging state of Keil C, how can we set and delete breakpoints?

Answer:

Method 1: Double-click with the mouse. Double-click the left mouse button at the very front of the line where you want to set the breakpoint to set or clear it.

Method 2: Use the command or command button. First, move the cursor to the line where you want to set the breakpoint, then click on the Insert/Remove Breakpoint command under the Debug menu or the corresponding button on the toolbar to set or clear the breakpoint.

There are also commands and buttons to disable breakpoints and clear all breakpoints.

In the debugging state of Keil C, how can we use the trace run, step run, and step out function run commands?

Answer: The difference between the Step command and the Step Over command: when encountering a function call, the former will trace into the function, while the latter executes the function in one step.

If you use the Go command for full-speed running, you can use the Stop Running command to stop execution.

To exit the debugging state, you can click on the Start/Stop Debug Session command under the Debug menu or the corresponding button again.

Operations in Keil C Debugging State

Leave a Comment