# If YOU were starting out now, what PIC16F-compatible IDE and compiler would you choose, and why?

This is going to be a bit long as I wanted to cover all the obvious questions before they arise, give a rationale to some of my thinking, and prove I've done my groundwork! If time is short, skip down to the tl;dr section to get to the meat. The banner above also says this looks like a subjective post, so I'm going to expand the post a bit to narrow down exactly what it is I want to achieve.

I've had a really good look around stackexchange and there are similar-ish questions to mine, and I found the question Starting out PIC Programming useful but most were asked and answered before the new release of MPLAB X which is now based around the open source NetBeans IDE which is quite a change, so might tilt the balance.

Background: I bought an Arduino recently and having never done MCU fiddling before, and my programming knowledge limited to PHP, I was quite pleased with the results.

There's a few "fun" things I want to do to start with to get going before the “proper” stuff...

• Make a kitchen countdown timer that rings a little handbell for a few seconds.
• Make a chicken door opener.

Eventually I want to....

• Build a data logger which will intercept and log the NIBE heat pump status and running time data from the external F2015 unit to the SMO 05 controller which runs on a CAT5 cable (once I’ve found out the data protocol!).

• Interface with the IR interface “eye” of my electricity meter and log hourly readings of the actual energy usage (as opposed to the highly inaccurate but cheap clamp-the-wire monitors).

Looks like I have some choices here:

Arduino/Freeduino: Incredibly fast start - I had it speaking the words “ready”, then “button up” or “button down” (depending on state) using the PCM library, loudspeaker and the Uno within a few hours of opening the box and with 30 lines of code. But for each and every concurrent project, you need an Arduino.

*The Picaxe *- uses PicBasic and special pre-bootloaded PIC chips. The system is incredibly cheap and fast to get learning, allows the programmed chip to be taken out and used standalone in a breadboard, but at some point I’m going to need to expand beyond PICBasic.

Even I could cope with these first two options. Mainly because each has one high-level simplified language to learn, and one simple all-in-on IDE/compiler/programmer.

Standalone PIC: Then there’s the bog-standard £2 PIC chip and super-cheap K150 programmer allowing the programmed chip to be taken out and used standalone in a breadboard.

So when a K150, cable, CD with hex flashing software and a couple of PIC16F690 chips arrived yesterday morning, I was starting with a blank sheet. I can write php and understand the basics of object oriented languages, and did a little C at college, enough to get me started quicker on the Arduino than if I’d done none. But I also understand that Arduino’s ‘Wiring’ is an extremely simplified superset of C, so I’m going to have to get more down and dirty for programming the K150 of course. Maybe assembler one day, but for opening a chicken run door when it gets light, I’m fairly sure C will suffice to start!

The problem I have is.... so many options!

I hope I have proved to have done my homework with this 12 sheet spreadsheet with over 200 listings and links to different types of projects, reference and help sites etc. According to Chrome I looked at 118 related sites on the day I got the K150, and over 330 relevant sites in the last 4 days. So I’ve definitely done some groundwork!

Yes, I know I should buy the PicKit3 and that somehow having bought the K150 makes me the spawn of satan according to the replies other K150 owners have got on forums. One day I’m sure I’ll buy it, but right now I’m just getting going as a hobby. I’ve bought an official Arduino so I’ve salved my soul that way!

tl;dr - enough waffle, what’s the question?!

As I understand it, as long as I can compile hex, I can program a PIC chip with the K150 or pretty much any compatible programmer.

Unless I’m mistaken, I have the following choices:

MPLAB X and PIKlab are both free IDEs compatible with most Microchips PIC chips.

Hi-Tech C Compiler, Sourceboost, Codeblocks and SDCC are all Microchips compatible compilers, some free like SDCC, some free with limited functionality, some only free for one specific chip.

Then there’s PicBasic Pro, £99 for the full suite or £30 for the student edition of the compiler alone. Right now, £99 is a fairly high amount for “having a play” - anything to recommend Picbasic over C?

I’ve also been watching some of the official and unofficial training videos for some of the above.

At this point in time, my intention is not world domination or the next RaspberryPI, it’s to be able to blink an LED, maybe take keypad input, maybe even make a Charlieplexed LEDcube for Christmas.

I’m getting on in my years and am of limited brain and time; the obvious thing would be to have the time to try all of the above and see which suited me. Not really practical.

I need to pick one, learn it, and stick with it. Yes, Google has been my friend, but a lot of the reviews of these IDEs and compilers refer to quit old versions. I’ve even found links to sites at Demon Internet and Geocities - 1994-1996 seems to be the peak bubble of activity for discussion on burning your own PIC code. And a lot changes in 8 years.

So my question would be:

If YOU were starting out now, what IDE and compiler would you choose, and why?

Thanks, and sorry this was such a long post!

-
Regarding Arduino, "But for each and every concurrent project, you need an Arduino" - Not really. You can breadboard and program the microcontroller of the Arduino, e.g. Atmega168 or 368, or even their cheaper, smaller cousins the AtTiny25/45/85, all available in DIP packages, all usable standalone. All you need is the Arduino bootloader, which is open source, and can be loaded onto the 168/328 MCUs. Smaller versions exist for the ATTiny. –  Anindo Ghosh Nov 22 '12 at 22:10
Similar story with the TI MSP430 Launchpad, which is a mere $4.30 including shipping and comes with a spare MCU as well. Again, these can be programmed, then breadboarded or used independently of the Launchpad. – Anindo Ghosh Nov 22 '12 at 22:11 1st: cheers for publishing all this homework! 2nd: i'd like to throw CCS into the mix. It's another IDE for PICs. – Nick Alexeev Nov 22 '12 at 22:40 Thanks for those tips, @AnindoGhosh. I didn't realise you could load your own Arduino bootloader. I am very interested in TI MSP430 Launchpad which completely passed me by. I found it here in the UK - the complete kit plus 2 MSP430 MCUs seems to be £2 CHEAPER than the cheapest single MSP430 I can find on ebay! This must be to promote the use of the chip? I've ordered one - thank you for this tip. – lardconcepts Nov 23 '12 at 11:05 @NickAlexeev - thanks for your comment too. I see that CCS is$50 for 12 bit and \$200 for 16 bit compiler. I've made a note of it, but I'll see how far I get with free compilers first! Thanks both. –  lardconcepts Nov 23 '12 at 11:07

If you really want to learn about microcontrollers, then ditching the arduino and all its layers that hide the details from you is necessary. A PIC 16 is certainly one bare microcontroller.

You definitaly want to use MPLAB, at least for debugging. Using anything else makes no sense, as MPLAB is free and officially supported by the manufacturer. Microchip now also has a full line of compilers that are free, with the only difference from the full versions in that some optimizations are turned off. That should be of no consequence for someone learning and experimenting, and you get to use the same compilers most other people are using and that therefore have the most eyes catching bugs.

However, if your aim is to really learn something, you should do a few projects in assembler. This will force you to learn the lower levels and open your eyes to what really goes on at the hardware and instruction level. That insight is very useful even when writing higher level code, and you won't be reluctant to implement a key module here and there in assembler as it may be appropriate.

-
Thanks Olin. I take your point about assembler. At first glance it scares the hell out of me, but it's just like learning anything I suppose. Answer accepted. –  lardconcepts Nov 26 '12 at 19:41

I see no reason to ditch the Arduino IDE. It is simple and fast, and as you said, a simpler set of c + there are so many contribs to the thing that it makes work just too easy. I completed a huge two processor project using the Arduino IDE in less than 2 months, and it works flawlessly.

But of course, if anybody knew what I used it I would be flamed for not using one of the more conventional ide's. The whole idea is to get machine code generated as fast as possible to get a working product.

Why complicate things?

The arduino/atmel lineup is infinitely easier than any other embedded product design studio anywhere, especially if you need fast results, and a super short learning curve. Just don't tell the boss.

-
Thanks Doug. I'm gonna rate you up because I totally agree - "Why complicate things?"! But I'm going to accept Olin's answer as his was specifically about PIC chips. (Sorry!) –  lardconcepts Nov 26 '12 at 19:38