Recommended PIC 16 Series compiler and language

Thread Starter

hunterage2000

Joined May 2, 2010
487
I have recently started using a PIC 16F887A and I have been using jaledit to do a few simple examples ie blink a LED. Can anyone tell me the most commonly used compiler and language and the easiest to use please? I have heard about PICbasic and pascal but nothing else.
 

debjit625

Joined Apr 17, 2010
790
Most commonly used compilers are the C compilers...
I use C language and for that I use MPLAB as the IDE and HI-TECH C compiler
Good Luck
 

t06afre

Joined May 11, 2009
5,934
MPLAB is free. And the XC8 compiler is also free to download. XC8 is the former Hi-Tech C compiler. The free version is more than good for hobbyist use
 

t06afre

Joined May 11, 2009
5,934
so when you use C do you just save the file as a .hex file and upload to the PIC?
Given that your code is error free. The compiler will create a hex file. If you use a microchip programmer/debugger or compatible. You can do the programming directly from the MPLAB tool
 

Thread Starter

hunterage2000

Joined May 2, 2010
487
I have downloaded and installed XC8 compiler in free mode but there is no app icon just 2 pdf's and uninstall. I tried xc8.exe in C://microchip/xc8/v1.11/bin but command prompt flashes on and off. Any suggestions how to open the app?
 

Thread Starter

hunterage2000

Joined May 2, 2010
487
So where is the project properties? in program files I see bin, dat, docs, etc, include, lib, rollbackBackupDirectory and sources folders. bin has loads of executables and an xc8.exe which does nothing.
 

t06afre

Joined May 11, 2009
5,934
No you have it all wrong. You use MPLAB GUI, and run the compiler from inside the MPLAB. So just install MPLAB. And just in case reinstall the XC8 compiler. Then you are ready to go
 

crutschow

Joined Mar 14, 2008
34,432
I use Basic for microprocessor programming, but I'm in a minority I know. I find it a lot easier to understand than the arcane syntax and structure of C. C is like learning a foreign language (and I'm terrible at that). Basic uses common English words. I know C is more compact and efficient to write but I'm more interested in ease of understanding as compared to efficiency. Efficiency is certainly more important if you are writing thousands of lines of code but few hobbyists to that... ;)
 

John P

Joined Oct 14, 2008
2,026
I have an old version of the CCS compiler, but recently I got BoostC, which covers more chips. It's the free version, so there are limitations in the size of code and the amount of RAM it'll handle, but it's working OK for me.
 

takao21203

Joined Apr 28, 2012
3,702
I use Basic for microprocessor programming, but I'm in a minority I know. I find it a lot easier to understand than the arcane syntax and structure of C. C is like learning a foreign language (and I'm terrible at that). Basic uses common English words. I know C is more compact and efficient to write but I'm more interested in ease of understanding as compared to efficiency. Efficiency is certainly more important if you are writing thousands of lines of code but few hobbyists to that... ;)
I have done something in QBASIC:

-Creating a large array of 4500 points.
-Rotating these points in 3D (X,Y only).
-Sorting the list using QSORT, so I am also able to rotate the color on the ring.

I used computed points for ellipses.

When you want to access array in BASIC, you are quite limited by the language. There is always a fixed datatype.

In C, you can (if you wanted to)

-declare individual "strings" made from 16bit integers indeed
-build an array of pointers pointing to each individual string
-read a pointer from the array, but use it as 8bit byte pointer

The one or the other way it is possible in BASIC. But C is far more flexible!

Arrays and pointers are somehow interchangeable. But for an array, you need an extra index variable. So if you use jagged arrays, in BASIC this becomes a mess quickly.

The QSORT is also kind of a pain, you need to modify it to work on a fixed datatype.

And yes C is more compact.

If you download the QB64 (for Windows), you really see why BASIC is called a beginners language. With some exceptions of course...
 

takao21203

Joined Apr 28, 2012
3,702
What can one make wonder is the pointer declaration syntax:

char *data_ptr

Then you also de-reference the same way:

char c=*data_ptr

When I learned c++ with Visual Studio, I figured out

char* data ptr

also works equally.

I would say C provides more possibilities for an elegant solution, if you have a complex problem. If it is really only super-simple programs, BASIC might be better. There is not as much language threshold as in C.

I remember when I was younger and used MSDOS BASIC compiler, we also had C compiler installed in school. It was horribly complicated. I could not even make it compile the supplied samples.

The route I went was to learn assembler, after I started with BASIC. Only after that, Windows C++. C for microcontrollers, well I used assembler for years, but this caused problems, as my programs became larger.
 

tshuck

Joined Oct 18, 2012
3,534
I use Basic for microprocessor programming, but I'm in a minority I know. I find it a lot easier to understand than the arcane syntax and structure of C. C is like learning a foreign language (and I'm terrible at that). Basic uses common English words. I know C is more compact and efficient to write but I'm more interested in ease of understanding as compared to efficiency. Efficiency is certainly more important if you are writing thousands of lines of code but few hobbyists to that... ;)
I do that on a regular basis!

though, I will agree, C has a steep learning curve with another one when migrating to C++...
 

crutschow

Joined Mar 14, 2008
34,432
I have done something in QBASIC:

-Creating a large array of 4500 points.
-Rotating these points in 3D (X,Y only).
-Sorting the list using QSORT, so I am also able to rotate the color on the ring.

I used computed points for ellipses.

When you want to access array in BASIC, you are quite limited by the language. There is always a fixed datatype.

In C, you can (if you wanted to)

-declare individual "strings" made from 16bit integers indeed
-build an array of pointers pointing to each individual string
-read a pointer from the array, but use it as 8bit byte pointer

The one or the other way it is possible in BASIC. But C is far more flexible!

Arrays and pointers are somehow interchangeable. But for an array, you need an extra index variable. So if you use jagged arrays, in BASIC this becomes a mess quickly.

The QSORT is also kind of a pain, you need to modify it to work on a fixed datatype.

And yes C is more compact.

If you download the QB64 (for Windows), you really see why BASIC is called a beginners language. With some exceptions of course...
But that's my point. I believe we are talking about beginners. C is a very difficult language for a beginner to learn. It's really jumping into the deep end of the pool to learn how to swim.

I can see that for performing complex functions, like manipulating large arrays and using various data types. C is likely better. But how many hobbyists ever do that?
 

takao21203

Joined Apr 28, 2012
3,702
But that's my point. I believe we are talking about beginners. C is a very difficult language for a beginner to learn. It's really jumping into the deep end of the pool to learn how to swim.
Somehow this is true. But also there has never been too much effort to produce "beginner friendly" compiler manuals. Some are just cryptic. Sometimes, there is even no manual available. I used for instance a command line compiler, floppy disk based. Before of that, only Windows C++ (with all the help, the debugger etc.). This way I learned how to apply typecasts (the source was written for another compiler).

These days things are much easier: There are many volunteers who maintain websites with tutorials. And you can ask on forums!

I can see that for performing complex functions, like manipulating large arrays and using various data types. C is likely better. But how many hobbyists ever do that?
If you download this QB64 package, it actually contains a large number of samples. Some sources are amazingly complicated. Qbasic (and now QB64) is worth examining for any programmer- as a first language, or not.

When I had DOS available on Win98, I used QBasic to try out math problems. It is kind of interpreted (no compile time). And this makes things easier a bit. I used it to maintain some statistics (OK nowadays I use Excel for that). I even used it to backup sources codes, together with .BAT files. On modern Windows, I don't really want to specialize and to learn new CLI scripting languages.
 
Top