Getting Started with Development Tools
Development Tools Home
Getting Started Development Tools Home
Step 1 An Overview of Embedded Systems
Step 2 Start Now with Microchip Development Tools
Step 3 Implementing an Embedded System Design with MPLAB® IDE
Step 4 The Development Cycle
Step 5 MPLAB® Project Manager
Step 6 Language Tools
Step 7 Target Debugging
Step 8 Programming
Step 9 MPLAB® IDE: For More Information
Getting Started with MPLAB Editor
Getting Started with MPASM/MPLINK
Getting Started with MPLAB SIM
Getting Started with MPLAB ICD
Getting Started with MPLAB C18 1
Getting Started with MPLAB C18 2
Getting Started with MPLAB C18 3
Introduction to Microchip’s Development Tools
Introduction to MPLAB® IDE
Tips and Tricks Using MPLAB® IDE v6.61
Introduction to MPLAB® SIM Software Simulator
Basic dsPIC Development Tools
Introduction to the Signal Analysis PICtail daughterboard
Choosing a Debug Tool
MPLAB® IDE User's Guide
MPLAB® IDE Quick Chart
MPLAB® Download Page
Online Discussion Groups
Development Tools Selector Guide
Available Books
Third Party Tools
  Featured Products
 

Pick your MCU
 
 
     

STEP 7 - TARGET DEBUGGING

In a development environment, the execution of the code is tested on a debugger. The debugger can be a software program that simulates the operation of the microcontroller for testing or it can be special instrumentation to analyze the program as it executes in the application.

Simulators are built into MPLAB IDE so a program can be tested without any additional hardware. A simulator is a software debugger, and the debugger functions for the simulator are almost identical to the hardware debuggers, allowing a new tool to be learned with ease.

Simulator Debugger

Usually a simulator runs somewhat slower than an actual microcontroller, since the CPU in the PC is being used to simulate the operations of the microcontroller. The speed of simulation depends upon the speed of the PC, the PC’s operating system, how many other tasks are being run in the background, and the complexity of the simulation.

Hardware Debuggers and Programmers

There are two types of hardware that can be used with MPLAB IDE:

    programmers

    hardware debuggers

A programmer simply transfers the machine code from the PC into the internal memory of the target microcontroller. The microcontroller can then be plugged into the application, and it will run as designed.

Usually, however, the code does not function exactly as anticipated, and the engineer is tasked with reviewing the code and its operation in the application to determine how to modify the original source code to make it execute as desired. This process is called debugging.

As noted previously, the simulator can be used to test how the code will operate, but once a microcontroller is programmed with the firmware, many things outside the scope of the simulator come into play. Using just a programmer, the code could be changed, reprogrammed into the microcontroller and plugged into the target for retest, but this could be a long, laborious cycle if the code is complex, and using this “burn and learn” technique makes it difficult to understand exactly what is going wrong in the hardware.

This is where a hardware debugger is useful. Hardware debuggers can be of various types, using specialized hardware in place of the actual target microcontroller.

A hardware debugger, like a simulator, allows the engineer to inspect variables at various points in the code, single-step to follow instructions as the hardware interacts with its specialized circuitry.

Debugging usually becomes urgent near the end of the projected design cycle. As deadlines loom, getting the application to function as originally designed is the last step before going into deployment of the product, and typically has the most influence on producing delays in getting the end product finished. That's where an integrated development environment is most important.

Doing fine “tweaks” to the code, recompiling, downloading, testing –-all require time. Using all tools within a single environment will reduce the time around the “cycle.” These last steps, where critical bugs are worked out are a test for the embedded systems designer. The right tool can save a lot of time.

With MPLAB IDE many tools can be selected, but they all will have a similar interface, and the learning curve from simulator to low-cost in-circuit debugger to powerful in-circuit emulator is small.

This chart displays the trade-offs:

Feature Comparison of Microchip Hardware Debuggers

Emulation System

PICkit

MPLAB ICD

MPLAB REAL ICE

Cost

about $80

about $220

about $500

Trace analyzer

No

No

Yes

Complex breakpoints

No

Yes

Yes

Opto-isolation option

No

No

Yes

High Speed, low noise option

No

No

Yes

Step 6: Language Tools

Step 8: Programming