Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Tutorial
NI Supported: Yes
Publish Date: Apr 25, 2007


Feedback


Yes No

Related Categories

Related Links - Developer Zone

Related Links - Products and Services

R&D Staff Tip of the Month

5 ratings | 3.60 out of 5
Print

Overview

The R&D Staff Tip of the Month allows the software developers and quality assurance staff at National Instruments Electronics Workbench Group to showcase the features of NI Multisim that they know will be helpful to the design engineer.

R&D Staff Tip of the Month

To make source code development for microcontrollers easier, the NI Multisim MCU Module includes an interactive debugging environment that facilitates the debugging process. Using the debugging tools you can follow and track the sequence of events in a program using breakpoints, debug stepping and a view of the memory and registers populated during simulation. With these features you can interactively check the C and assembly code created for the microcontroller.

 

Carlos S.

Quality Assurance Specialist

 National Instruments Electronics Workbench Group

 

 

 

 

See For Yourself

The installed sample file WatchdogTimerWakeup.ms10 provides a demonstration of the debugging capabilities in the Multisim MCU Module.

  1. Open NI Multisim 10.0 (Start >> All Programs >> National Instruments >> Circuit Design Suite 10.0 >> Multisim)
  2. Select File >> Open Samples
  3. Select the MCU Sample Circuits folder
  4. Click on the PIC Samples folder
  5. Open the WatchDogTimerWakeup.ms10 circuit

With the MCU project open, it is time to build the code to be loaded onto the microcontroller.

  1. Expand the WatchDogTimerWakeup.ms10 file in the Design Toolbox so you can see the various code modules associated with the MCU circuit design (as seen in Figure 1).

Figure 1- Design toolbox

 

  1. Select MCU >> MCU PIC16F84 U1 >> Build to build the source code (as seen in Figure 2).

Figure 2 - Build MCU Code

 

  1. Double click on the WatchDogTime_Wakeup.c file to open and view the C source code.

With the source code open, it is easy to begin the debugging process. We begin by setting a breakpoint.

  1. To view the line numbers in the source code select MCU >> Show Line Numbers in the file menu.
  2. Browse to line 25 of the C code, and select MCU >> Toggle Breakpoint
  3. Select MCU >> MCU PIC16F84 U1 >> Memory View to open the memory view to monitor values during the simulation process (Figure 3).
  4. Click on the run simulation button.

Figure 3 - Open MCU Memory View

 

You will notice that simulation will pause at the set breakpoint, and the debug view will open automatically. In figure 3, you will notice a red box which highlights the MCU toolbar. Configure the toolbar in the same manner as shown in Figure 4 to customize the debug view of the source file.


[+] Enlarge Image

Figure 4 - NI Multisim Debugging Features

 

In the blue box of Figure 4, you will notice the MCU source code instructions to increment the value in the address 0x0C. To view this action, focus upon the IRAM memory view (Figure 5 – notice that the value of 0x0C is 00).

Figure 5 - IRAM Memory View

 

  1. Step over to the next instruction to view the memory at address 0x0C increment by clicking on the “Step Into” icon of the simulation tool bar (red box of Figure 6). Notice the address increments to a value of 01.

Figure 6 - "Step Into" on Simulation Toolbar

 

5 ratings | 3.60 out of 5
Print

Reader Comments | Submit a comment »

 

Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).