Keil Logo

Debugging Programs

The HELLO and MEASURE example programs are designed to run on the Keil MCB167 test board using the MON166 target monitor. You may use these example programs to verify the operation of the monitor and configuration for your target systems.

Before you can download and test an application with MON166, you must compile and link the files in the project. If you are using one of the example programs, select Keil MCB167 as the target (from the tool bar) and build the project.

Toolbar Target Selector

When you are ready to begin debugging you will use several buttons on the toolbar to start the debugger, step through your program, and so on.

Button Description
Debug Button When you start the debug session, the µVision debugger connects to the target board, downloads the monitor (if it's configured for bootstrap mode), and downloads the application program. In the event of a communications failure, µVision presents a dialog that displays options and instructions.
Step Into Button
Breakpoints Button
Run Button
MON166 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 MON166 can share the serial interface, used for monitor communication, with the program being debugged. 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 or NMI 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 or so) a dialog box 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.