Using MPLAB.X on Ubuntu 11.04 64bit with Dwengo boardI have been using for quite some time to program my from within Linux, but as the source code grows larger, the Pinguino “sketches” aren’t always the most convenient code structure. In addition, and more important, I notices some weird unstable behavior where initializing a string variable with string A worked fine but initializing it with another string resulted in the code not being able to compile.
By default, MPLAB X IDE will be installed at C:Program Files (x86)MicrochipMPLABX. If you would prefer a different directory, click on the folder icon to the right of the text box and select the desired installation location. Click image to enlarge. Select Programs.
As Microchip has released a, I tried setting it up on my 64bit Ubuntu (v11.04 aka ) today. This article is a step-by-step tutorial on how to compile your code with MPLABX, load it on the Dwengo board and run or debug it using the Dwengo programmer. Go to the, select “Linux x86 (32 bit)” as the platform (there is no 64 bit version) and check the boxes “MPLAB IDE X” and “MPLAB C18 Lite Compiler for PIC18 MCUs”. Then hit “Download now”. Do it fast, because a reeeeally annoying video (which you can’t stop) automatically starts playing upon loading the page!. Two installer files will start downloading, make them executable:chmod +x./mplabc18-v3.40-linux-full-installer.runchmod +x./mplabx-ide-beta7.02-linux-32-bit-installer.bin. You can try to run the graphical installers (just double-click the files), but on my 64bits Ubuntu this gave the elaborate “Segmentation fault” error message.
The problem is documented, and solved by running the installers in text mode. So first install the C18 compiler: sudo./mplabx-ide-beta7.02-linux-32-bit-installer.bin -mode textand then install the IDEsudo./mplabc18-v3.40-linux-full-installer.runedit: got the graphical installer working, as explained. Just one more hurdle to go!
As the MPLABX is a 32bits version and uses Java, it expects to run on a 32 bit java virtual machine. However, the default Java you’ll install on Ubuntu via the package manager is a 64bits version. Follow the instructions on to run the IDE using a 32 bits Java version. Basically you install a 32 bits Java in some folder and create a shell script which points the JAVAHOME and PATH environment variables to this Java. At this point, you installed the environment succesfully and you should be able to start it without getting any errors.
I start the script created in step 4 with sudo, because otherwise I do get some errors (and I’m not that into sorting out all kinds of file permissions) of files being read-only.Now we will install the Dwengo library. Download it as a zip file from, and extract it. You’ll get two folders, one with a.lib file in it and another one with the header files (.h extension). In a terminal, cd to the extracted folder and copy the.lib file to the lib folder of mplabc18 and the.h files to the /h/ folder (the exact destination folder can differ on your system depending on where you installed C18):sudo cp./lib/dwengo.lib /opt/microchip/mplabc18/v3.36/libsudo cp./h/.h /opt/microchip/mplabc18/v3.36/h/Ok, we are set to go! Fire up the MPLABX IDE and let’s create a project In the file menu, click “new project”. A dialog pops up.
Select “Standalone Project” and click “Next”.The Dwengo board ships with a PIC18F4550, so select this as the device:The Dwengo programmer is compatible with PICkit2, a MicroChip programmer/debugger device. So select this as the tool and click next. The nice thing about using this device with the MPLAB software is that we will be able to actually debug our code! That is breakpoints, step-by-step and other goodness instead of tediously writing variables to the LCD.Select C18 as the compiler toolchain:Finally, name your project:A project structure is created, shown on the left. We will start out by adding the Dwengo library by right clicking “Library Files” and selecting “Add existing file”. Select the.lib file we downloaded earlier.Next we add the linker file, needed for successfully compiling your code. Right click on “Linker files” and select the file 18f4550g.lkr which you’ll find in the folder /opt/microchip/mplabc18/v3.36/bin/LKR (or something similar, depending on where you installed C18).And now, finally, we can add some actual code ?I used the Dwengo “blinking Leds” example, which you can find.
Once the code is added, right click your project and click “clean”. This will remove any previously compiled code and asserts that you are not working with any old version of your code.Now right click your project and click “build”. I got a lot of errors on the console window, but clicking “build” once more successfully compiles and links all code.
MPLAB X IDE is a software program that runs on a PC (Windows, Mac OS, Linux) to develop applications for Microchip microcontrollers and digital signal controllers. It is called an Integrated Development Environment (IDE), because it provides a single integrated “environment” to develop code for embedded microcontrollers.MPLABX Integrated Development Environment brings many changes to the PIC microcontroller development tool chain. Unlike previous versions of MPLAB which were developed completely in-house, MPLAB X is based on the open source NetBeans IDE from Oracle.