Keil Logo

Debugging Programs

Many of the example programs provided with the Keil C51 Tool Chain are designed to run on the Keil MCBx51 Evaluation Board using MON51. You may use these example programs to verify the configuration and operation of the monitor for your target systems.

Before you download and test an application with MON51, you must compile and link the files in the project. If using one of the example programs, select the MCBx51 target (from the toolbar) and build the project.

Toolbar Target Selector

There are several buttons on the toolbar you may use for debugging.

Button Description
Debug Button When you start the debug session, the µVision debugger connects to the target board and downloads the application program. In the event of a communication failure, µVision presents a dialog that displays options and instructions.
Step Into Button
Breakpoints Button
Run Button
MON51 supports most µVision debugger features. You may single-step through code, set breakpoints, and run your application. Variables may be viewed using standard debugger features.
Serial Window Button MON51 can share the serial interface, used for monitor communication, with the target program. Serial Window #1 shows the printf and putchar output from the target program.

Note

  • Do not initialize the serial interface in your user application. The monitor configures the UART. Subsequent configuration changes may cause the monitor to lose synchronization with the debugger. You may use conditional compilation as shown in the example programs.
  • It is impossible to single-step through putchar or getkey I/O functions.
Stop Button If the Serial Interrupt option is enabled you may stop program execution using the Halt command from the Debug menu or toolbar or by pressing the Esc key in the Output Window.

The Monitor uses the serial interrupt to halt the user program. If the Monitor cannot stop your program (because the user application has disabled interrupts) a dialog opens that displays options and instructions.
Reset Button The µVision Reset command sets the program counter to 0. However, peripherals and SFRs are not reset. This command is not identical to a hardware reset of the MCU.
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.