PIC Development & Sublime Text 2

Last modified date

Comments: 2

While working on a small PIC project as an addition to a larger project (a JUMA RX1 DDS LSB/CW receiver) I had the displeasure of using Microchip’s IDE MPLAB. MPLAB looks like it was designed in the mid-90’s, and while it does let you piece together code and compile it into PIC compatible hex, it’s not the most user friendly program.

While I was battling with MPLAB a friend re-tweeted a link about a new theme for Sublime Text 2, I had a look at the link and the editor looked pretty good! After doing a bit of reading I found out that Sublime Text has the handy ability to call user defined build systems with a hotkey, and as I read on I thought I’d have a crack at getting it working with the XC8 compiler in an attempt to ditch MPLAB.

Linked below is a small project I put together, based very heavily on a set of guides located at Gooligum Electronics. The main requirements to use Sublime to replace MPLAB are a Build System script, and a project specific build file that is launched by the Sublime build system script. This build file specifies various settings (chip type, project name, build options etc…), and is used by the XC8 compiler.

toggle-switch-led-1.0.zip – The most basic of programs, one step above a “Hello World” example. A momentary push-button is used to toggle 2 indicator LED’s along with another output pin that will be connected to the PIC chip in a JUMA RX1 radio (to switch between and display which of the two VFO’s is in use). Alongside the source files are the Sublime project files, one for Mac and one for Windows.

XC8.sublime-build – This is a multi platform version of the XC8 build-system file I am using with Sublime Text. This file will need to be loaded into the correct folder depending on your platform…
Mac: /Library/Application Support/Sublime Text 2/Packages/User/
Windows: C:\Users\<username here>\AppData\Roaming\Sublime Text 2\Packages\User\

Notes:

– The build-system above will need to be tweaked to point at your XC8 install, the project file will need to be pointed at the location of the project. Watch out for back-slashes on Windows, they need to be doubled up (escaped) to be treated as literal in the path.

– You can download the XC8 installer for various platforms here.

– This method can be used to run pretty much anything, you could substitute any build programs/scripts or even flash a microcontroller with this.

2 Responses

  1. hi ross
    are you have some snippet and autocomplete for xc8 ?
    can you share me you xc8 stuff for sublime
    thanks

    • Hi mohsen, I haven’t done much more than integrate the XC8 build process into a Sublime build system.

      This post contains the basic steps to configure and use the build system, along with the required files.

Leave a Reply to Ross Cancel reply

Your email address will not be published. Required fields are marked *

Post comment