Migrating to for PIC MCU is not really a hard task. The developers have taken much care in keeping it that way.
In addition to the existing features of the C18 compiler, there are a lot of other added features in the HI-TECH C compiler. This post will give you an introduction to the compiler, its features and how to write C programs in it.
All HI-TECH C compiler demos and updates can be downloaded from the Microchip website. Click on the compiler below to access its downloads. HI-TECH C Compiler for PIC10/12/16 MCUs. HI-TECH C Compiler for PIC18 MCUs. HI-TECH C Compiler for PIC32 MCUs. C sample code for PIC micros and Hi-Tech C. Example Hi-Tech C code. The downloads below are freely available and downloadable from Microchip and Hi-Tech. Click on HI-TECH C Compiler. Users interested in Hi-tech c compiler for pic18 mcus generally download.
This compiler can be used to program all 8 bit PIC MCUs. There is one compiler for series and another for series. You can choose the compiler based on the family of controller that you are working with. Most of the time the code is interchangeable between the compilers, only the device specific references such as the configuration bits and SFRs may differ. Why the HI-TECH C compiler?
The Microchip C18 compiler has been around for quite some time and has a lot documentation and device specific library functions. Yet, I feel that the HI-TECH C compiler is much more elegant and easy to program. Some of the major features are listed below.
You no longer have to write PORTBbits.RB0 to access PORT B pin 0. Just use RB0 and you are done. Now this saves a lot of time and gives more readability to the code. The same is true for all SFRs (INTCONbits.GIE is now just GIE). The reason is that the previous method used structures (more specifically bit-fields) to access the port pins. Now the individual bits are mapped on to their respective addresses.
Using Interrupts in your code can never be this easy. You can create an ISR like you would create a function and place the keyword ‘interrupt’ in between the return type and function name.
Functions like printf & scanf are now available in HI-TECH C compiler under the header file stdio.h. The c18 compiler does not have this feature. In C18 compiler global data chunks larger than 256 bytes cannot be accommodated without having to modify the linker scripts. I had one hell of a time adding fonts for a GLCD code I wrote some time back. On the other hand, the HI-TECH C compiler takes care of the work for you.
If you are a linux user, HI-TECH C compiler has a good integration. There are no device specific header files in the HI-TECH C compiler. You just have to include htc.h to all your source codes. The compiler determines which device you are using from the project properties and includes the necessary headers. This reduces the time taken to port the code form one device to another. Some people have reported to have better code optimization with this compiler.
I have neither verified it personally nor did I verify the authenticity of the information (I came across this information in a forum thread). Install the compiler You can download the lite version of the compiler. A lite version compiler is sufficient for any hobby project that you can think off. If you ever feel that a lite version compiler is not good enough for the work you are doing, start optimizing your code to run fast or occupy less space. If you still can’t reduce the size, the project is no longer a hobby project and you ought to buy a pro version and start selling your product.
Follow the on screen instruction to install the compiler. Check the options to add the path to the MPLAB environment variables so that the IDE knows where you have installed the compiler. Working with HI-TECH C compiler After the installation, you can see the compiler in the list of available compilers when creating a new project in the IDE. Choose this compiler and choose next.
After the project is created, add a C source file and start coding your C program. In all the programs, you will have to add this line, #include this will include header file for the PIC MCU that you choose while creating the project. Once this is added you will have to add code for the configuration bits. This is really important and most of the time, it will prevent the program from executing if you forget to add the pragma for the configuration bits. I will write a tutorial on configuration bits, their purposes and uses some time soon.
Independent Review of the Hi-Tech C compiler for Microchip PIC18x Update on 10th November 2007 - tested the latest version of the Hi-Tech C compiler, v9.62. It produces code that is definitely smaller, and seems to be 100% backwards compatible. The PICC18 compiler produces C code for the Microchip PIC18Fxxx series of micros. It is available from Hi-Tech C,. I've been using PICC18 for the last 8 months. In this time, I have not had any problems that can directly be attributed to the compiler.
This continues a good tradition of nice products from Hi-Tech C. Previously, having used PICC for the PIC16Fxxx microcontrollers, I had spent 4 years, with only a couple of problems that could be directly attributed to the compiler.
All of these problems were fixed promptly. PICC18 is currently in use in many commercial settings, with excellent success. I am a long time user of Microchip PIC micros - 5 years in fact.
I tend to trust the Hi-Tech C crowd. They produce compilers for a number of other microcontrollers, which shows they have experience in the compiler area. I would agree that Hi-Tech C is probably the best compiler on the market for the PIC micro. It produces tight, small, fast code. However, it doesnt come extremely cheaply - one must pay for quality.
I would recommend Hi-Tech C for any company. For a small-time hobbyist, I would suggest the free demo verison of Hi-Tech C for the 16F84. You can read. Pros of Hi-Tech PICC18. In 5 years of use, the Hi-Tech C compiler has not exhibited any code-generation problems. You can trust Hi-Tech C to produce accurate code. Good code optimizer produces tight code.
Supports a Real Time Operating System (RTOS) with the third-party addon, Salvo RTOS. Recommended in a company situation where it is absolutely necessary to have a compiler that developers can trust to produce accurate code.
Good range of build in functions. Comes with source code for all its libraries. In-built support for interrupt service routines. Cons of Hi-Tech PICC18. More expensive than other compilers. Does not have a code-generation wizard, like CCS C.
Website Hi-Tech C for the PIC18X microcontrollers is available for $US850 from. Cross-grades are cheaper. A is available for evaluation from the. What do you think of this article? You can post public feedback on this article on the, or email me on. More Reviews. Addendum 'How I upgraded my C code from the PIC16877 to the PIC18452 microcontroller' Heres a story told to me by another embedded C developer, explaining his experiences upgrading from the 16F877 to the PIC18F452: 'We have a design based on the PIC16F877 microcontroller.
It is written in Hi-Tech C, with the aim of monitoring a large amount of data flowing from a number of sensors. We had run out of room on this micro, 8K was not enough for our needs. When the PIC18F452 was released by Microchip, we decided to upgrade. These new chips are pin compatible with the 16F876, and have double the memory (16kwords), and double the maximum speed (40Mhz).
We got hold of the PICC18 compiler from Hi-Tech C, which can compile for the PIC18F452. At first, when we ran it through the compiler, it gave some errors. However, with a few minor tweaks, we had it compiling under the new architecture. We programmed the new chip up, plugged it into the chip holder, and to our satisfaction it worked beautifully. We didn't even need to do a board revision! Time taken for the upgrade: 2 hours. The new chip has a number of more powerful features compared to the older 16F877 chips.
It has multi-level interrupts, which are a real bonus when doing any interrupt service routines. We changed INT0 to make for a simpler interrupt service routine. This new code has been running flawlessly for a while now.' When you're upgrading 16Fxxx code to 18Fxxx code, here's what you have to change:.
Change '#include ' to '#include '. The PIC18Fxxx microcontrollers have multi-level interrupts. Change the code to take advantage of this. This step is optional.