I'm switching compilers!

November 28, 2017

Years ago when I started learning how to program Pic microcontrollers I started programming using a compiler called Hitech C which was run in Mplab.  I had only been using it for a month or 2 before I started working at my current job where all the pic programming was done using the compiler Picbasic Pro run in MicroCode Studio IDE. At that point since I was still fairly new to Pic microcontrollers I decided it would help my learning process if I just used Picbasic Pro at home as well. At the time I also didn't want to be programming pics in two different languages either. All my projects from that point on that used Pic Microcontrollers were programmed using Picbasic Pro.  I've gotten used to a lot of its features over the years. One of the things I especially like about Picbasic Pro is its built in functions. Implementing software controlled SPI,I2C, or UART on any pin is simple and usually only takes a couple lines of code.  In fact, I would often use the "Serout" command to serially debug my programs. This was especially advantageous because  I was not stuck with using the dedicated Tx pin on the microcontroller; I could use virtually any pin I wanted .

 

 

More recently though I realized I want to one day try using the PIC24 and PIC32 family. Unfortunately neither of these are supported by Picbasic Pro.  At the moment it only supports 12F,16F, and 18F.  I started looking into some of the compilers available and this is when I knew that I'd need to start programming in C again if I'm going explore other Pic micro families. 

 

After some research, MPLAB's XC8 compiler seemed like the best program to switch to.  Although it doesn't have the built in commands like Picbasic Pro does, switching to XC8 will open a lot more doors for me in terms of different chips I can potentially use as well as the different kinds of programs I will be able to make. Since it is arguably more popular than Picbasic Pro, there are much more user written libraries available online for download which I can use, most notably libraries meant for things like usb, canbus, TCP/IP control which i'd like to get into one day. 

 

One of things I am most excited about is that I am now able to properly debug using Mlab and my Pickit 3. While I am aware that I can run Picbasic Pro in Mplab, I figured this is the best opportunity to learn how to properly debug since I am completely switching IDE's anyway.  I can now upload the program to the microcontroller and manually step it through the program while looking at all the internal registers and variables directly which I am using instead of having to write code to serially output the data I want to look at.  Its funny because I've been avoiding doing actual debugging all these years because I had assumed it would be much more complicated to do than it actually is. 

 

One final advantage to switching to XC8 is that I am finally able to use float variables. This will especially come in handy for times when I need to apply a calibration curve to an incoming ADC value. Since Picbasic Pro cannot use float variables, all my math had to be done using integers.

 

Anyways I'm excited for what's to come. There is no doubt going to be a bit of a learning curve, but since I am already familiar with the way Pics function, the biggest learning obstacle at this point will just be familiarizing myself with C again.   

 

 

 

 

 

 

Please reload

Featured Posts

Eagle 8.6 First Impressions

February 7, 2018

1/3
Please reload

Recent Posts

November 28, 2019

November 28, 2017

November 2, 2017

October 16, 2017

Please reload

Search By Tags
Please reload

  • Facebook Classic
  • Twitter Classic
  • Google Classic
Follow Us
This site was designed with the
.com
website builder. Create your website today.
Start Now