We use many Microchip® products in our chipKIT™ and chipKIT Pro boards, so it is important to understand the various individual aspects that each board has to offer, along with the different integrated development environments (IDEs). In this project, we will be covering the characteristics of both available IDEs. The overarching differences between the user experience using chipKIT and chipKIT Pro boards is highlighted below in Table 1.
Table 1. Differences between chipKIT and chipKIT Pro.
|Language Options||C, (C++, Assembly)*||C, C++, Assembly|
|IDE (integrated development environment)||MPLAB*, MPIDE||MPLAB, MPIDE|
|Built in Debugger?||No||Yes|
* With the edition of the chipKIT PGM Programmer/Debugger.
The main difference between using a chipKIT Pro series board and a chipKIT board has everything to do with debuggers. MPLAB® is more intended for use with the chipKIT Pro series boards, while MPIDE lends itself more to being used with chipKIT boards. In order to use MPLAB with chipKIT boards while maintaining an understanding of the code, users will need to utilize the chipKIT PGM Programmer/Debugger, which has more limited uses. Of course, MPLAB doesn't offer as streamlined and simple of a user inteface as MPIDE, so the platform preference is up to the user.
A debugger is a tool within most IDEs that allows you to pause your code at any point or line. Within your code, you can put breakpoints where the debugger will stop running the code. Wherever the code stops, you are then given the opportunity to look at the values in your variables or registers. Alternatively, you can add watch variables (they may be called something else depending on which program you use) that allow you to see the values at any time in your debugging session.
There are many instances where this is extremely helpful. Say your program breaks while running and you have no idea why; a debugger allows you to run through the code line by line so you can find exactly what line breaks your code. Then you can see what your values are and what you are doing to cause the error.
Another place where a debugger is invaluable is when you are working with pointers. A common error in programming is in printing memory locations. A debugger allows you to follow the particular pointer you are working with line by line, and it makes sure you are referencing or dereferencing it correctly (i.e., making sure you are manipulating either the value or the memory location intentionally). It is very easy to get frustrated when attempting to print out a data set and instead get memory locations!
Microchip's MPLAB X IDE is a debugging environment as well as an editor that integrates a compiler. The figures below illustrate the use of a debugger in the MPLAB environment.
Upon opening MPLAB, you can see that it is a fairly complex IDE.
As displayed in Fig. 2 above, you can put a break point wherever you want to stop the code from running. On the bottom of the window, you can see the variable tab where you are able to create watch variables. If you create a watch variable, you can see the values change between each step. Through the next few images, watch the value of t1.
When I step to the next line, I am using a logical AND to change the value of t1. You can watch it change in the watch variables.
The next step is a shift left logical. You can see the value of t1 in hexidecimal shift to the left.
This next step stores the value of t1 into LATB. You can see both of those variables now share the same value.
The final step doesn't change any of the watch variables, it just jumps back to the loop label.
Being able to watch variables like this is immensely helpful when writing complex code. You can find exactly which lines and which variables aren't working correctly and easily fix the problem. However, using a debugger isn't really necessary with all of the help that MPIDE offers, especially if you are writing simple code and using any of the several diverse libraries. Within the MPIDE interface, there are an abundant number of examples in C.
The multi-platform integrated development environment (MPIDE) is a modified and extended form of the Arduino™ IDE, meant to support the PIC32-based chipKIT boards without hindering the compatibility of traditional Arduino boards. Several of the other Learn Site and Digilent Instructables projects offer more in-depth examples and explanations.
As you can see, the startup window of MPIDE displayed in Fig. 7 is very simple compared to MPLAB's interface.
Now that I've highlighted some of the differences and features of MPIDE and MPLAB, go to the Microchip website and try them out for yourself! Depending on your intended project, you might find on to be more useful than the other. With all of the different features available in each program, you might find you enjoy using both.