Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Been away awhile - questions on getting back into this...

Status
Not open for further replies.
Hi all. I've been away from programming uC's for over two years now. Before I "left" I was pretty good with assembly in 16Fs and was trying my hand at Swordfish and another basic language compiler for the 18Fs.

I want to get away from coding in assembly. It was a good starting point, but it takes too long to get to anything worthwhile. I'm trying to decide what compiler I should go with, but I have forgotten most of the details of what is out there.

My criteria:
1: Less than $100 for a license (STRONGLY prefer FREE)
2: Supports all/reasonably most 18F PICs (supporting all 16Fs would be great too)
3: Readily available tutorials
4: Whether Basic or C... I don't want it to be a particular dialect that is so quirky I couldn't readily transfer those skills to another compiler of the same language
5: Enough good libraries available so I don't have to re-invent the wheel.

Further Questions:
Has Microchip always owned Hi-Tech? It looks like Microchip is pushing Hi-Tech C. Does this mean that C18 in MPLAB is being phased out?

Anything new in the world of PICs in the last two years that's worth being aware of?

Thanks!
 
Hello,

The Microchip XC8 is pretty good for all the 8-bit offerings by Microchip. The Hi-Tech for PIC16F and the C18 has already merged into one compiler already.

For the Basic, I recently acquired the Oshonsoft ones for a very low price (regional discount). They are a very good try also, and have some simulation software for you to get your hands on. If I'm not mistaken it's like $80 for PIC16 and PIC18F.

The MikroC is good, but the price exceeds your criterion ($249), so I can't say much on this (the compiler). However, the libraries for MikroC is abundant and LibStock (collection of libraries made by others) helps a bit more.

Some 32-bit PICs have breadboard friendly packages, like the PIC32F1x0, in DIP28. Combine this with the XC32, more fun will be coming out from there.
 
For C on an 18F PIC you can't go wrong with XC8. As mentioned above this is indeed a rebadged HiTech C after Microchip bought the company. Some nice improvements have been made since Microchip bought them. The Microchip libraries should work with it and you'll get good help around the internet, certainly on the official Microchip forums. The free version doesn't optimise after the demonstration period but this really isn't a huge problem. I have plenty of code which works great without optimisation, just buy a bigger PIC and be done with it.

If you have specific requirements, are already a C expert or just fancy tinkering then look at SDCC. But don't expect the same level of support, free code or service as XC8.

One last option is a third party vendor C compiler like mikroC. If you want to buy a compatible development board then the mikroC libraries are probably quite useful. If your goal is to design everything from the ground up then you might find that some design choices have already been made for you in the libraries that constrain what you can do.

I don't have enough experience of the third party compilers to compare but I did try BoostC from Sourceboost and, sorry to say, it was horrible.
 
What was wrong with it? How long did you use it for?

It would be unhelpful to the original poster to go off on a total diversion.. however the biggest problem I had was the limitations in storing data in ROM.

I finally dumped it (for HiTech) after about a year when I started working on a font library for graphic LCDs. BoostC flat out refused to allow large ROM arrays in v6 (see **broken link removed**) and whilst that may have changed in v7 others on this forum appear to have had similar issues with v7. A **broken link removed** appears to suggest it is still worse than other compilers with ROM data.

You can see my question from when I switched on ETO here: https://www.electro-tech-online.com/threads/pic-c-compilers.107133/. And you can see the sort of data I am storing in ROM here: http://github.com/edeca/Electronics/blob/master/Include/fonts/font_verdana.h

I'm very happy now with XC8, but encourage the original poster to look into some of the other suggestions in this thread to make up their own mind.
 
Last edited:
Thanks for the advice guys.

I don't program with C yet, but I want to learn. It sounds like the XC compiler is the way to go. I'm not worried about the optimization. I could use asm where needed, but as one of you suggested I could just get a bigger PIC.

I'm downloading it now. It integrates in with MPLAB, correct?
 
Really simple thing.... C18 was a bit more honed.... With Hitech ( now XC8 ) you have more low level programming.... There are no libraries for the peripherals... With C18 you can open the library HTML doc and see which version / pic functions you could use..

Ie...

openUSART(config);

Or

openPORTB(config);

Do you see what I mean..... With Hitech you are back on the data sheet to configure your peripherals.... I don't mind... I just miss some functions...
 
Do you see what I mean..... With Hitech you are back on the data sheet to configure your peripherals.... I don't mind... I just miss some functions...

Absolutely, I hadn't thought of those reasons.

This is why I chose HiTech in the first place, because I wanted to force myself to learn enough about the peripherals. However it is much slower and I turn projects round in a longer time due to it. It also means that the best thing for me is to stick with a small number of PICs (currently 12F1840 and 18F2xKxx) rather than rely on a library to get better support across devices.

If I was doing this for work or wanted to teach others who don't have quite my enthusiasm then I'd probably have made a different decision.
 
I would highly recommend C over BASIC or assembly. Assembly is too time consuming (anyone who says otherwise has obviously not programmed in other languages) and CPU specific, and BASIC is not really that transferable either, in my opinion it is a dead language (apart from some microcontroller compilers and interpreters, the only other thing that uses BASIC is Visual Basic, enough said!).

Every platform typically has a C compiler, so it is the most transferable language you can learn. You could be writing programs for your PC too with knowledge gained about C.

I also prefer C18 compared to Hi-TECH C (I presume XC8 is the Hi-TECH 18F compiler re-badged). The libraries and documentation are nothing short of first class in C18. My old university had both installed on the project lab machines, from memory the Hi-TECH offerings usually did a better job of code optimisation, but left more for the user to do in terms of writing code.

As someone who has worked with 8051s, PIC’s (16F,18F,PIC32,PIC24), MSP430 and AVRs, I no longer have the urge to code the "long way". If there is an off the shelf library for setting up a timer, peripheral or anything else, I will use it.

SDCC is not too bad either, and is free. Works pretty well for me under Piklab in Ubuntu. I would imagine there are guides out there for getting it set up with MPLAB...
 
Last edited:
SDCC is not too bad either, and is free. Works pretty well for me under Piklab in Ubuntu. I would imagine there are guides out there for getting it set up with MPLAB...

Why bother... VSM studio from Labcenter is free.... And integrates SDCC beautifully... I use it for my 8051 endeavours..
 
From a long time Swordfish & ASM user I'm forcing myself to learn XC8.

On the plus side I quite like the MPLABX editor (the IDE takes some getting used to) and as a bonus it works with OSX too.
 
Last edited:
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top