Recommended PIC 16 Series compiler and language

Discussion in 'General Electronics Chat' started by hunterage2000, Nov 9, 2012.

  1. hunterage2000

    Thread Starter Active Member

    May 2, 2010
    400
    0
    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.
     
  2. debjit625

    Well-Known Member

    Apr 17, 2010
    790
    186
    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
     
  3. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    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
     
  4. hunterage2000

    Thread Starter Active Member

    May 2, 2010
    400
    0
    so when you use C do you just save the file as a .hex file and upload to the PIC?
     
  5. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    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
     
  6. hunterage2000

    Thread Starter Active Member

    May 2, 2010
    400
    0
    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?
     
  7. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    When you use MPLAB X, you can simply select the installed compilers in the project properties.
     
  8. hunterage2000

    Thread Starter Active Member

    May 2, 2010
    400
    0
    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.
     
  9. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    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
     
  10. hunterage2000

    Thread Starter Active Member

    May 2, 2010
    400
    0
    yeah nice one got it all up and running. Thanks for the suggestions and help fella's ;)
     
  11. crutschow

    Expert

    Mar 14, 2008
    12,993
    3,229
    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... ;)
     
  12. John P

    AAC Fanatic!

    Oct 14, 2008
    1,632
    224
    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.
     
  13. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    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...
     
  14. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    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.
     
  15. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    I do that on a regular basis!

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

    Expert

    Mar 14, 2008
    12,993
    3,229
    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?
     
  17. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    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!

    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.
     
Loading...