MPLAB X vs MIKRO C thoughts

Discussion in 'Embedded Systems and Microcontrollers' started by odm4286, May 18, 2016.

  1. odm4286

    Thread Starter Active Member

    Sep 20, 2009
    So over the past year I've experimented with MPLAB X with the PIC16F628A. Now I'm learning to use MikroC. I'm curious to see what the general opinion is on MikroC vs MPLAB X. So far, MikroC seems to make things easier but hides a lot from you. In my humble opinion I feel like too much abstraction could lead to problems in larger projects. Thoughts?
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    I quite agree. There was a fellow who used to post here who normally was quite accurate in his assessments, but not when it came to Micro C. Since it does indeed hide some important details such as the configuration settings (not in pragmatic code but thru a menu window) or the include file for a specific processor (again it uses them but hides the included file reference) he was two steps behind what was actually happening with some importaint details.

    Just the include file itself is a bad thing to hide: if you know you must include it you know where it is and can search it for symbols you may need.

    Otherwise MicroC is a good product capable of generating good code, though why you would buy something when you can get something comparable for free is beyond me.
  3. dannyf

    Well-Known Member

    Sep 13, 2015
    it all depends on who you are and what you want to do with a given toolchain.

    MikorC is like Arduino for PIC: it is designed to ease someone' getting up the learning curve. As such, it is user friendly and provides lots of useful pre-cooked functions to get you going without much pre-work, including reading the datasheet.

    Like Arduino, mikroC does give you the option to cook your own code ground-up, if you so desire.

    So it seems to me that you aren't really into understanding the hardware side of things and you are more application focused, it is not a bad place to start and to stay.
  4. NorthGuy

    Active Member

    Jun 28, 2014
    I always read datasheets before I do anything, and IMHO, it does pay off, in a long run anyway. Once I read it, I want to use my knowledge. Therefore, when the code uses the same entities (bit, registers) as the datasheet, it is much easier for me. I wouldn't trade this for pre-cooked functions which may or may not do what I want.

    However, as I understand, most people don't read datasheets, so using registers is totally bizarre to them. Therefore pre-cooked functions work well for such people. Of course, when pre-cooked functions don't work, they don't know what to do, blame it on Microchip or Mikroelektronika, and IMHO lose much more time and efforts compared to what they would spend reading the datasheets.

    Hence my opinion: Microchip compilers are free. Mikroelectronika's are not. I don't see any substantial difference which would be worth paying for.

    Another bad thing about Mikroelektronika is that they're very slow in adapting new chips. Which leads us to the next point. You use ancient PIC16F628A. Meanwhile, Microchip made really good progress and they have much more advanced chips, including much better PIC16F1* series which they call "Enchanced Midrange", as well as powerful PIC24/dsPIC33 chips. Instead of studying different compilers, may I suggest looking at newer chips.
    nsaspook likes this.
  5. odm4286

    Thread Starter Active Member

    Sep 20, 2009
    Complete opposite, I prefer to toggle bits to get the µ to do what I want. MikroC is just a another thing to learn at this point.
  6. JohnInTX


    Jun 26, 2012
    MikroC is fine for a lot of things but XC8 is the better compiler when it comes to managing the PIC's architecture. For example, in MikroC, even 'const' strings are copied into RAM on startup. If you are using more 'const' strings than you have RAM, you are sunk without employing some workarounds. While MikroC has extensive library support that can help get things going with little effort, you have to do things their way and that sometimes conflicts with other code you are writing. XC8 is much more bare bones - you have to write more of what MikroC provides yourself - but you get the code that you want. MikroC's simulator is not as good as MPSIM for interrupt driven stuff and it's not as smart about stepping over long execution time code like delays etc. but you can load the .COF file that MikroC generates into MPLAB for symbolic debugging in the simulator.

    As the others have said, MikroC lags XC8 in new part support and you may have to pay for a compiler upgrade for some. XC8 supports new PICs from their introduction.
    XC8 makes better code IMHO, especially in Pro Mode and much better for the low end baseline PICs in any mode.

    In short, MikroC is a warm, fuzzy, comfortable environment that can get results if you are willing to do things its way and accept the limitations. I use it to crash together quickie test stuff.
    XC8 demands a bit more from the programmer but is much more flexible and will get more out of a given PIC with less overhead in most cases. I use it for paying customers.

    Just my .03
    Edit: Comments for MikroC Ver 6.x Professional, XC8 1.36 Professional. YMMV
  7. takao21203

    Distinguished Member

    Apr 28, 2012
    They are not free.

    Anyone who can afford should pay the price asked.

    I think the reason for free edition is to promote using the chips. And enable students etc with powerful tools for evaluation and to learn.

    Otherwise they'd resort to Assmebler uhm

    Did you even know most Arduino sources can be adapted to PIC?

    C scripts written using certain techniques can become optimized by the commercial edition, depending on the chip. There are special addressing modes.

    For many c scripts there's not a big effect whatshowever. So take care about 400% improvements.

    It's not relevant for occasional users or students all too much. They are not locked out even to undertake a large project.

    While stm chip compilers are difficult to download and there's a lockout for code size.

    Instead of complaining about the k8048 programmer I should realize it's designed for hobby use. I would have been better off with one of the mikroelektronika boxes and some advice that investment is required first. But anyway, I have become able to use just blank chips.

    Using this mikroelektronika board would have saved me 100s of hours.

    Doing all yourself relying on the xc compiler manual and Google it's not easy to learn all the basics. When there was only Hitech I had to cobble pointers together with illegal casting but xc is able to just do it. Spent hours disassembling until I learned to write C code that does the right thing.

    I've spent so much time and went unusual way I could write a book what not to do. On the other hand, doing what not to do, gives you problem solving skills.

    When you use ready made board library like mikroelektronika, you don't solve it yourself. Probably you'll think in schemes and thing something else is not possible. Like if supposed to be you use BASIC a lot.

    I remember home computers didn't have a clue cpu, io ports or addressing mode. Tried to understand it in terms of basic, failed. Though I was interested when I was young, wasted years with creepy development gear.

    While professional developers even back then, used c language, had the right documentation available.
  8. dannyf

    Well-Known Member

    Sep 13, 2015
    Then MikroC isn't for you. Big deal.

    The fact that it is not for sure doesn't mean it has no merit, or it isn't for somebody else, ...
  9. odm4286

    Thread Starter Active Member

    Sep 20, 2009
    Not saying it has no merit, at this point it just seems limiting.
  10. dannyf

    Well-Known Member

    Sep 13, 2015
    it is limiting only because you want to be limited by it. if you want / can, MikroC can behave every bit like XC or any other compiler, by your forgoinging all the library support MikroC offers. There is nothing in the MikroC environment that says you have to use such libraries.

    So it can be as limiting or unlimiting as you want it to be.
    odm4286 likes this.