Best and Cheapest compiler for PIC16F1786 - Page 1
Forum section: electronics / general

author: Paul Price
author_rank: Super Contributor
timestamp: May 29, 2013, 02:38:29 pm
content: I am using the Hi-Tech PICC pro C-compiler (ver 9.83 for PICC 10/12/16, now obsoleted by Microchip) to work with.I am very satisfied by its flawless operation.The16F1786is a very new chip that I am very interested in working with that is not supported by v9.83.I am only working in C, not assembler.Does anyone know how to hack to the Hi-Tech compiler's .h or other files that set the --chip info to add to the repertoire of chips it can handle?If not, what is the best and cheapest, well-working, easy to use, not adding garbage code compiler to use?Some have complained about the incompetency of the X8C compiler in past posts on this board.The latest version is X8-V1_12.exe and can be downloaded free and there is a free 60-day trial PRO version license available.Does anyone know if this newest PRO trail version has resolved much of its bug issues, that it does now work well, does it work the same as the paid licensed PRO version?If not, then what is the best alternative?Thanks to all in advance for taking the time to help.

author: blewisjr
author_rank: Frequent Contributor
timestamp: May 29, 2013, 06:39:12 pm
content: The pro trial works exactly like the Paid Pro version of XC8. You can even use the PRO Trial for commercial applications if you want. The free version blows really bad. Right now I am getting ready to try and port my code to SDCC to see if it is any better. As I can't afford $1000 for a damn compiler.

author: Paul Price
author_rank: Super Contributor
timestamp: May 29, 2013, 08:43:39 pm
content: I have tried SDCC and it really blows.Thanks for the help!

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: May 29, 2013, 10:53:01 pm
content: There are upgrade options to avoid the cost of a new compiler, and the are currently offering to upgrade to the latest XC8 (which still works with MPLAB 8.xx BTW).This listing implies that you need to already have a HPA agreement to renew, but I can't find another option. $100 to upgrade to latest version (and a year's worth of updates) isn't too bad.http://www.microchipdirect.com/ProductSearch.aspx?keywords=SW500005-HPAI recently renewed my compiler (couple of weeks ago) which I think was v9.60, and price was as above (less discount as I am a registered developer. I did not have a previous HPA agreement.The code shown on the order history is SW00005-HPRbut I can't find this order code now - not sure if it was a special offer.Defintely worth persuing though - suggest you contact Microchip.

author: Paul Price
author_rank: Super Contributor
timestamp: May 30, 2013, 08:23:21 am
content: Thanks, MikesElectricStuff.I do not have an HPA agreement, I got the Hi-Tech compiler already installed and working on a used computer I bought at a HamFest, so my situation would probably not allow me to purchase an upgrade option.Would somehow becoming a registered Microchip Developer help, I don't know what is required to do that?One big question still remains unanswered, with the experience you've so far had, do you find the XC8 compiler easy to use, does it produce bloat free code and does not crash and so then reliable and bug free to work with? Are you able to compare the use of XC8 with the Hi-Tech C PRO v9.83 compiler?

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: May 30, 2013, 08:36:46 am
content: Quote from: Paul Price on May 30, 2013, 08:23:21 amI don't know what the current procedure is - in my case it was getting to know a Microchip FAE and showing a track record of developing products. If you're developing commercially it's worth it as you get something like 40% off devtools and immediate replacement of any faulty dev hardware. They now call us"Design partners"If you are a freelancer, another benefit of being on their list is that periodically other manufacturers trying to build up their profile will contact you about getting onto their consultant list.QuoteThe Hitech/Microchip 8-bit compilers have always been excellent, producing good, compact code. I've never encountered any bugs.It's a pity they chose to use code bloat as the crippling method on the free version as I'm sure many people have got the wrong impression of the product.Ease of use is about the best of any compiler I've used on any platform - just adding #include <pic.h> is all you need in your code - it finds all the device-specific stuff automagically, and most of the common options and linker settings have sensible defaults, and are accessible as options within MPLAB so no need to delve into linker script files, even when juggling memory spaces for bootloaders etc.The "X"-ifying from PICC/C30/C32 to XC8/16/32 appears to just be a combination of rebranding and adding compatibility with MPLABX - the underlying compiler appears to be identical. They still work fine under MPLAB8.X

author: AlfBaz
author_rank: Super Contributor
timestamp: May 30, 2013, 08:59:19 am
content: Its been a while since being involved with microchip development so what have the done with the likes of C18?It was only good for Pic18 chips and the only C compilers for 16's and lower were the hitech stuff they took over. C32 was gcc and the last time I looked they were crippling the libs for it by "upgrading" them. I see now they finally have a C++ compiler for the C32, have they just added g++ to gcc?

author: Niklas
author_rank: Frequent Contributor
timestamp: May 30, 2013, 09:40:26 am
content: Quote from: AlfBaz on May 30, 2013, 08:59:19 amI have the C18 almost since it was released and a couple of months ago I began to use the XC8 for new projects. Microchip has an upgrade offer for the unlimited version of C18 to the Pro version of XC8:http://www.microchip.com/pagehandler/en_us/devtools/mplabxc/compilermigration.htmlNow I have both C18 and XC8. The only major problem I have had with XC8 so far was when I passed a parameter of the wrong type to the built in printf function.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: May 30, 2013, 01:03:29 pm
content: I think that both the 8-bit compilers have been combined into XC8.

author: Rufus
author_rank: Super Contributor
timestamp: May 30, 2013, 01:24:06 pm
content: Quote from: mikeselectricstuff on May 30, 2013, 08:36:46 amDoesn't sound like you used them much.They were pretty solid and the best PIC C compiler until they bought out the new Pro version with OCG. That version was late and buggy as hell when it shipped in 2008 it slowly got less buggy over the last 5 years a period which included the Microchip acquisition of Hi-Tech.For most of that 5 years I didn't consider it fit for use. I used the old version and wouldn't trust the Pro version without inspecting every instruction it generated - totally impractical for any large program.There were various bugs with it not accepting valid C and cases where it just gives up trying to generate code for valid C.Some of the others were truly horrendous.I had one where it was using a timer register as a temporary during expression evaluation. Imagine debugging something where an expression intermediate value was being occasionally and randomly incremented. Another where a temporary file register should have been saved in interrupt context but wasn't so was occasionally and randomly corrupted - a bug which might not show up in days of testing.In another evaluation of the second parameter of a function call overwrote the first parameter. These were bugs I noticed while trying to use it - I ended up using it very little. Today I still keep my fingers crossed.Hi-Tech's policy of providing bug fixes without needing HPA kept me up to date for years without paying for HPA. Not having HPA meant I didn't get XC8 free, but a copy of C18 got me that anyway.OCG is a good idea I think they underestimated how difficult it was and perhaps had financial and/or staff problems. The Microchip acquisition was strange with all of Hi-Tech's non-Microchip products just dumped and their 16 and 32 bit Microchip compilers promptly obsoleted. All Microchip got was the two 8 bit compilers. Microchip also adopted the pain in the arse licensing and activation scheme for all XC compilers.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: May 30, 2013, 02:14:37 pm
content: Quote from: Rufus on May 30, 2013, 01:24:06 pmcouple of dozen projects, mostly fairly smallQuoteMost of my usage is versions that predate that - always thought OCG sounded a bit of a gimmick.I tend to only do small stuff on 8 bit PICs - anything bigger tends to be ARM.

author: jebcom
author_rank: Regular Contributor
timestamp: May 30, 2013, 05:53:35 pm
content: QuoteQuoteWhat blows about these? Lack of optimizations, or is it something else?

author: Paul Price
author_rank: Super Contributor
timestamp: May 30, 2013, 07:57:03 pm
content: As for the PICC operation of the SDCC: sparse documentation, instances of limiting compilation because only a single error stops compilation requiring continuous cycling back and forth between source code and compilation checks to debug syntax errors, difficulty using the --help option will not pipe into a file, low or no optimization, need to completely rewrite code to fit compiler syntax for define port bits, config regs, special regs, does not seem to support bit var type, many PICC devices not supported, etc.Because of these difficulties, I really didn't spend more time than a few hours to test operation, as after a few hours attempting to work with SDCC PICC, my editing still failed to adapt and convert my rather large and complicated C source file(HTC PRO C compatible and compiles without error) to comply with SDCC syntax and gave up.

author: gocemk
author_rank: Regular Contributor
timestamp: May 31, 2013, 08:59:24 pm
content: Hi Paul,You can try mikroC from Mikroelektronika:http://www.mikroe.com/mikroc/pic/The PRO version costs 249$, and you can download a free version which limits your code size to 2kB. The IDE is very,very easy to use, but it lacks some of the fancy features like code completion, etc...I'm not sure about the quality of optimization though, i think there was a comparison on some of the other forums, but i can't find it right now.But it works for me for relatively small projects, etc...They also have a great community on mikroe forums and libstock.com.

author: Paul Price
author_rank: Super Contributor
timestamp: June 01, 2013, 01:17:23 pm
content: As for MikroC, I have a problem with any Demo Ver that limits code size because a compiler can really hide it's faults, bugs and optimizing performance in compiling a program that is both very complex and needs to really stuff as much code and data vars as possible into the available program memory space while optimizing var placement in the different RAM banks. Only that kind of testing really tests a compiler.