So, when you do feel the need to really optimise the hell out of a routine you can indulge yourself without causing too much of a headache.īefore we start, all compilers listed below have free trial versions with a limited life and they all fully integrate into the Microchip MPLAB IDE (integrated development environment). They allow you to embed assembler directly into the C code. C also lets you get down and dirty and easily twiddle registers and bits - It is designed for efficiently dealing with hardware.įinally, all C Compilers give you a get out of jail free card. What about Basic and Pascal? These languages are good for high level tasks like business software, but they hold you too far from the intimate details referred to above.
Even an application for the humble 16F88 chip with its 4K of memory would benefit from being developed in C, while complex applications written for the 32 bit chips are impossible to develop for in anything other than C. There are so many variables to keep track of, so many side effects from calling various subroutines, and so much complexity that in many cases it is impossible to continue using assembler. Anything that is much greater than 2K or 3K bytes in size starts to become a nightmare. This intimacy is also the downfall of assembler when a program gets large. This is essential when you are short of memory and must get the best speed from limited hardware.
When you write in assembler you are intimate with every detail of your code and this intimacy allows you to cut corners and craft some especially neat solutions. If you are familiar with C you can skip to the next heading.Īssembler gives you tight control of every CPU cycle and very efficient use of both program memory and RAM. This article looks at three C Compilers for the PIC series of microcontrollers from the point of view of the cash strapped hobbyist and makes some recommendations as to the best way to go.įirstly, a few words are necessary to explain why a C Compiler is such a good thing. This is where the users of the Atmel AVR series have a clear advantage, they have access to the GNU C Compiler for that chip. Unfortunately, due to the compiler unfriendly architecture of the Microchip PIC series, there are few free or low cost compilers available for the low end chips.
Something that might take a week to write and debug in the C language would take months if you were forced to use assembler - and, the assembler code would be buggy and hard to maintain. Writing your microcontroller firmware in a high level language is so much easier than writing in assembler.
NOTE: This page is a very much out of date now - it is retained here for archival purpopes only
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Australia (CC BY-NC-SA 3.0)