I'm a newbie here and I was hoping to draw upon the collective wisdom of your members. first of all let me say in no uncertain terms that I do not fancy myself a programmer. I have tinkered around with PIC microcontrollers for a few year using assembler (MPASM) and a little basic (PIC Basic Pro). I can usually muttle through making a simple project with these tools. But now I find myself deployed with a lot of time on my hands and I want to put it to use learning to program in C.
My question is, which compiler do you recommend to learn on? I downloaded the compilers Hitech C, CSS C, and Mikroe C. Using each compiler I wrote a simple LED chaser program that merely sequences the 8 LEDs attached to portD on the 44 pin demo board that came with my PicKit 2 programmer.
Of the three compilers, I found that it was easiest to get the program up and running with CSS C (it was running in a few minutes), next was Mikroe C (it took some tweaking) and I had the most difficulty with Hitech C.
It seem that although each claims to be ANSI compliant, this doesn't prevent them from using thier own convensions. For instance, int in CSS C is defaulted to 8 bit unsigned (if I remember corectly) and in other compilers int is 16 bit signed or unsigned (I forget..getting confused).
Also, CSS C uses mostly built in function and I think has no linker capability. Not sure if this is bad or not? And there are so many other differences between all of them that it makes my head swim.
So, now that I am totally confused on what I should be looking for in a compiler, does anyone with any programming experience have any wisdom to offer a newbie on which way to go?
I was just checking out some of the new features in mplabX recently and I was quite impressed with the code configurator plug in they have now. It gets you over the initialization of peripherals in the chip which is such a headache sometimes. It generates all the code necesary to get you started using whatever peripheral resources you need for your project.
It also has code complete features with a dropdown box. The simulator for testing your code in mplab or mplabx is very helpful too.
Definately check out mplabX and it’s xc8 compiler. I’m not sure if the latest version of mplabX has code configurator plugin installed by default but it’s very easy to add it in anyway. I don’t think you’ll be disappointed.
Theres a video here to explain the code configurator.
@Merser and Birdmun - Thank you for sharing your experience with me.
For some time I have been using MPLAB 8.91 (and previous versions) to write code using MPASM. And I like the integrated tools like the software simulation and the fact that it works with all the hardware tools that I have aquired over the years (Pickit 1, Pickit 2s, Pickit 3s, and more recently ICD 3). Some of the compilers that I list above were usable from within MPLAB 8.91 which is why I was considering them.
When MPLAB X first arrived on the scene, I took a cursory look at it and decided that (for my needs at the time) it did not offer enough substantive changes to warrant switching over to it. Admittedly, I have never given it a second look over the years.
After viewing the videos of the Code Configurator plugin I was floored. I did not elaborate in my original post, but peripheral initialization was a big part of the difficulty that I experienced with both Hitech C and MiKroe C. CSS C took care of the setup with built in functions which made it very simple, much like Code Configurator does only without a GUI.
As I am writting this I am in the process of downloading MPLAB X, XC8 compiler,and the Code Configurator plugin to try out. I really appreciate everyones assistance on this because, if this solution pans out (as I hope it will), it will allow me achieve my goal with a minimal investment. And as an added bonus, I can still use the hardware tools that I already own and am most familiar with.
I have been coding PICs now I have been coding PICs now for around 8 years, with the last 4 using ‘C’ as my primary language, and my only tip would be, if you can afford the extra few pence/cents upgrade to a pic24 or dspic33. The c30 and XC16 compilers are sooo much easier to use than the 8 bit ones, and give you errors that might actually help you debug your code. The 16 and 32 bit pics are optimized for C, so that helps too. I cannot recommend any particular text to learn C, but again all the pic24 samples are written in C, so i learned by modifying them, combined with sites like this, and stack overflow to answer the hard questions.
Good luck with your endevour, since starting ‘c’ on the pic, i have moved to c (well c#) as my main desktop language too. And my skills and employability have improved as a result of that.
I appreciate you taking the time to help me out by sharing your experience. I tried to download MPLAB X and XC8 to get started learning. Unfortunately, I discovered that the compiler would not find include files uless they were in the project directory. I went online and found that others had this problem too. I tried the fixes that were given and each time they failed. At this point I am so frustrated with the whole process. I’m too obstinate to give up! But I do know when it’s time to step back, take a deep breath, and maybe take a different approach. So I’ve decided to wait until I return home to pursue this project. While here I’m going to concentrate on learning to program the Arduino that I just received.
What you said did not fall on deaf ears, when I return home I’ll order a 32 bit starter kit from Microchip and use that to learn with. In the meantime I will continue to use PBP3 and MPASM for my 8 bit project until I have a better handle on this.