What IDE and compiler should a PIC-programming newb choose?

Anything not related to a specific project.

What IDE and compiler should a PIC-programming newb choose?

Postby lardconcepts » Thu Nov 22, 2012 4:32 pm

Hello, I'm Jon, based in mid-Wales, interested in making products for people with visual impairments.

Hope this post is acceptable and fits in with the "first post" criteria!

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.

I had a great training course recently at BCA in Birmingham with Arduino-evangelist Garry Bulmer who was running an excellent one-day course.

I was so enthused I bought an Arduino Uno kit on the spot and was chuffed when, two evenings later with nothing more than the Uno, 1 switch, 1 resistor, 1 speaker and 3 bits of wire, I had the Uno saying "ready" and then "button up" or "button down" depending on the state.

Having never done MCU fiddling before, and my programming knowledge limited to PHP, I was quite pleased. Next project is to use a cheap Freeduino to see if I can make a light activated chicken-run door opener for under £20.
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. Both for under £10 each.

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 in under 4 hours of opening the box and 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. which can be found at (sorry, can't post links yet!). According to Chrome I looked at 118 related sites on the day I got the K150, and over 330 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!
lardconcepts
Newbie
Newbie
 
Posts: 3
Joined: Thu Nov 22, 2012 10:21 am

Re: What IDE and compiler should a PIC-programming newb choo

Postby sqkybeaver » Thu Nov 22, 2012 11:27 pm

i'd start with mplab and the microchip compiler.

in the embedded world C is basically the defacto standard language.

sdcc was originality written for the 8051 variants, works well for '51 but limited support for microchip devices. sdcc will work with any ide that will allow you change the compile commands.

microchip bought one of the 3rd party compilers a while back(can't remember the name) but their standard compiler works well and will allow you to compile example code without changing code for comparability.

the other compilers have limits (time, optimization, size, devices)

arduino is fast to learn (a few hours without interruption) but hides a massive amount of low level stuff you will never learn unless you get into writing your own hardware libraries.

starting with arduino/clone is not a bad way to start, and moving from prototype to production should not be to hard.
User avatar
sqkybeaver
Hero Member
Hero Member
 
Posts: 1095
Joined: Tue Dec 07, 2010 8:50 am
Location: New Hampshire, USA

Re: What IDE and compiler should a PIC-programming newb choo

Postby oakkar7 » Fri Nov 23, 2012 4:20 am

I started with MPLAB and MPASM (microchip assembly ) then switched to C. Agree with sqkyveaber, C is a defacto standard for embedded. Microchip acquired and bought Hi-Tech C.

- For IDE and language, I recommend MPLABX and XC compilers. These are free and compiler is unrestricted for personal use except limited code optimization. I don't think code optimization is not much in account for a beginner. And it support all devices, existing Microchip libs.
Here is a quote from link http://www.microchip.com/pagehandler/en_us/devtools/mplabxc/#optimization-levels
MPLAB® XC Free Edition:
- Supports all the devices and commands of the Standard and PRO Editions
- No time or memory restrictions
- Limited code optimizations
- Unrestricted use—ideal for a low-cost academic or commercial solution
- Allows for all the code optimization and commands of the PRO Edition for 60 days – you decide when to turn it on.
An option to activate the use of the PRO Edition features and optimizations is included. After 60 days, the compiler will revert back to the levels of the Free Edition

- For a beginner, the most expensive device will be a programmer. I tested and built many Programmers and ended at Pickit-2. You can buy cheap clone (20$ ebay) or original one (34$). I do't know about K150 but it seem OK. There is also Pickit3 but its expensive and personally I still have no reason to buy this.

- For PIC, 16F690 is a right choice. 18F2550 is a choice for next upgrade.

cheers,
oakkar7
Newbie
Newbie
 
Posts: 38
Joined: Thu Aug 04, 2011 8:37 am

Re: What IDE and compiler should a PIC-programming newb choo

Postby lardconcepts » Fri Nov 23, 2012 6:16 am

sqkybeaver wrote:i'd start with mplab and the microchip compiler.
[...]
arduino is fast to learn (a few hours without interruption) but hides a massive amount of low level stuff you will never learn unless you get into writing your own hardware libraries.


Yes, that was my thinking too - great to make something quick, but to me, it seems Arduino is like learning to drive, top up the washers and pump up the tyres (or tires depending where you are!), while "proper" C is being able to do a full service yourself and check the timing belt, while Assembly is being able to built your own car from a kit of parts and understand exactly how internal combustion works etc. Reasonable comparison?!


TBH, I was gravitating toward MPLAB X, but in my googlings I'd come across a sort of slightly snooty hostility toward MPLAB. But then again, most of what I was reading would have applied to the previous non-Netbeans version.

Something I hadn't noticed before is that the XC compiler is also free, albeit with limited optimisations. That definitely sways me!

oakkar7 wrote:For PIC, 16F690 is a right choice. 18F2550 is a choice for next upgrade.


Ah, good! Well I've got everything I need here to get started then, and with both your advice, I know exactly how I'm going to start and what to use. Thanks again!
lardconcepts
Newbie
Newbie
 
Posts: 3
Joined: Thu Nov 22, 2012 10:21 am

Re: What IDE and compiler should a PIC-programming newb choo

Postby Sleepwalker3 » Tue Dec 04, 2012 4:33 am

Another suggestion if you wanted to go with the BASIC language, is 'Great Cow BASIC' which you can pick (PIC?) up on Sourceforge at the link below. I put up a post on DP maybe 6 months ago asking if anybody here had used it, but it seemed nobody had. All reports I've seen about it said it was good and stable, but I've never actually used it myself yet.
[url]gcbasic.sourceforge.net[/url]

Other than that, if you're thinking along the C lines (which is certainly the most widely used), then take the recommendations from those above.

Mikro compilers I'm told are really good and come in C, Pascal and BASIC versions for PIC, AVR, ARM, etc. but are expensive.

If you do end up trying Great Cow, let me know how you went with it, as I haven't tired it yet, but would like to if it's decent.

Cheers
User avatar
Sleepwalker3
Hero Member
Hero Member
 
Posts: 539
Joined: Mon Jan 16, 2012 4:12 am
Location: Down Under

Re: What IDE and compiler should a PIC-programming newb choo

Postby Sleepwalker3 » Tue Dec 04, 2012 4:36 am

Oh, I should mention that GC basic has two types, a normal BASIC compiler - OR- for those wanting really simplistic programming, it has a graphical drag-and-drop icon editor that works like a flowchart, but obviously that's for real beginners.
User avatar
Sleepwalker3
Hero Member
Hero Member
 
Posts: 539
Joined: Mon Jan 16, 2012 4:12 am
Location: Down Under

Re: What IDE and compiler should a PIC-programming newb choo

Postby Bertho » Tue Dec 04, 2012 7:23 am

You should use the tools geared for the job. There is no magic bullet when developing. You define your needs and search for the tools that will do the job. The "proper" way in development is to make something that fits the job. It may not be nice, elegant or ingenious, but does that matter if it gets the job done(*)?

You can use any type of processor, compiler, assembler,embedded system, operating system and whatmore. It does not matter as long as it fits your needs. Most users/developers have a preference for one or another processor/tool/library/..., but that does not mean it fits your specific needs.

You have learned to use an arduino. That is fine and it seems it has been doing the job for you that you set out to do. The way to progress is to look at your project(s) and take advantage of the acquired knowledge and use it to the maximum extent possible. Once you hit a (brick) wall, you need to change your way of thinking.

Each processor/tool/... comes with a learning curve. Some might be extremely steep. So, you may want to take advantage of a chosen path to the max before you endeavor into unknown territory.

--
Greetings Bertho


(*) experience is a prerequisite for doing things "right". However, you need to make mistakes to acquire experience.
User avatar
Bertho
Sr. Member
Sr. Member
 
Posts: 347
Joined: Mon Sep 19, 2011 4:34 pm
Location: Somewhere in the vicinity of Betelgeuse

Re: What IDE and compiler should a PIC-programming newb choo

Postby arakis » Tue Dec 04, 2012 7:57 am

Personaly if | was starting now Id go for the mplabx xc compilers, PICKit3...MPLAB x is more comfertable to work with, XC compilers are ok C compilers, and PICKIT3 makes sure you have the latests devices suported...

I\d skip the 8 bits all together, there is no need to start there, in the pic architecture and compilers basicly everything is the same be it 8bit 16 or 32...( not talking about the actual architecture of the processor) only that writing code for any PIC is 90% the same. And limiting yourself with low end devices at the start is nonsence...

For learning the PIC24 is almost prefect, it has all the bells and whistles, like PPS, but it;s as easy to work with as the pic10F...Sure you have bucket load more peripherals, but you are not required to use them, etc...Plus the price is not that bad, with devices starting from $2, you'll stay with pic24s for a long time.

Only posible reason why they are not ideal is that they use only 3.3V isted of the more beginner standard 5V
best regards FIlip.
arakis
Crew
Crew
 
Posts: 1044
Joined: Wed May 25, 2011 11:15 am
Location: Belgrade, Serbia

Re: What IDE and compiler should a PIC-programming newb choo

Postby bearmos » Tue Dec 04, 2012 8:25 am

Selcome to DP, lardconcepts!

All great advice from the posts above.

The new MPLab-X is a lot better than the old MPLab 6/7/8(whatever) - the IDE is very nice/usable now for code editing. Your N150 looks very similar to the old knock-off ICD-2's, which aren't supported under the released version of MPLab-X AFAIK.

I think the 16f device is probably a good start - not having to wade through hundreds of pages of documentation is nice when you're starting out (even the peripherals offered probably have more simplistic usage). After using the 18f devices I might skip these and go for the PIC24, mainly just because I don't like the way ISR's need to be implemented on the 18f (I think PIC24 has "proper" vector tables) and the pin re-mapping makes PCB layout easier.

In regards to "what specific chip should I use", I agree completely that you should use what fits the bill, but when you're starting out, you can also use what's popular in a community. I think overall DP tends to lean towards talking about PIC's (probably because most "official" DP projects are PIC based. That being said, the community/forum has experience with AVR's, 8051 variants, MSP430, ARM's (specifically cortex M from what I've seen), etc. The thing I like most about DP is that members are generally "well behaved", you won't find too many flame wars and there's usually just a lot of good information/opinions being shared.

Also, you're welcome to start project logs over in that board, you'll find that you can get some really great feedback that way.
bearmos
Hero Member
Hero Member
 
Posts: 744
Joined: Tue Nov 02, 2010 10:02 pm

Re: What IDE and compiler should a PIC-programming newb choo

Postby t0mpr1c3 » Tue Dec 04, 2012 10:36 am

Hi Jon,

Not to tempt you away from experimenting with PICs (which I know nothing about) and chicken-related stuff (which is how I started out in electronics a couple of years ago)... but I am developing an open source Arduino speech shield which I hope will be useful in gadgets for the visually impaired & I'm very happy to share ideas and/or hardware.

viewtopic.php?f=19&t=4562
viewtopic.php?f=19&t=4807
Magic Smoke projects
Tindie store
User avatar
t0mpr1c3
Full Member
Full Member
 
Posts: 200
Joined: Mon Sep 17, 2012 4:51 am

Re: What IDE and compiler should a PIC-programming newb choo

Postby lardconcepts » Tue Dec 04, 2012 5:14 pm

Wow - I'm away for a few days and come back to be spoilt by all this excellent advice!

I've pretty much settled on MPLAB X - just need to put some more learning time in now...

Interesting looking project t0mpr1c3 - the thing is, I've decided to go down the "speech snippets" route.
Any speech synthesizer that would be used to read more than one, or perhaps two words, would have to sound AT LEAST as good as this http://www.cereproc.com/files/sarah_weather.wav and that ain't gonna happen on an Atmega anytime soon!

Here's one of the first things I did with the Arduino - https://www.dropbox.com/s/nwof7ydc17vh8 ... .31.03.mp4 - , which is my Arduino flashed with 25k out of the available 32k (see below re EEPROM) of codespace which INCLUDES the speech, PCM library etc.
It takes just under one second from reset or cold-boot to say "ready", and then I've recorded me saying "button", "up" and "down" just to prove the system.
Yes, the audio is ropey because it's literally just the chip, no amp, driving a tinny speaker and I had to super-compress the speech.
But add on a bit more EEPROM and that might be a solution. Still limited to pre-sampled speech.

Haven't worked my way though your blog and project completely yet, though. But definitely bookmarked for further reading!

Once again, thanks everyone for all the tips and hints; hadn't even heard of gcbasic before. A shame, it looks like a really good intro to PIC programming. Every school should have one!
lardconcepts
Newbie
Newbie
 
Posts: 3
Joined: Thu Nov 22, 2012 10:21 am

Re: What IDE and compiler should a PIC-programming newb choo

Postby t0mpr1c3 » Tue Dec 04, 2012 8:15 pm

The kind of speech quality you are after might be realistic using Flite on a Raspberry Pi or something like that. Flite kind of knits together speech samples and is probably a bit heavy on processing power and memory for an embedded device.

Phoneme based methods that might fit on a microcontroller are inevitably a bit computer-sounding but that is (still) good enough for Stephen Hawking.

I would like to know what the cheap talking calculators use. I would think a small number of samples stored on an EEPROM.
Magic Smoke projects
Tindie store
User avatar
t0mpr1c3
Full Member
Full Member
 
Posts: 200
Joined: Mon Sep 17, 2012 4:51 am


Return to General discussion