Limited time offer: FREE HI-TECH C PRO® for the PIC32 MCU Family
NEW: HI-TECH C® PRO for the PIC10/12/16 MCU Family - Now Available
PICC™ STD and PICC-Lite™ now with support for 64 bit Microsoft Windows Vista
Omniscient Code Generation: as featured in EDN Hot 100 Products of 2007.
![]() |
If you are using an older version of the compiler, or for some reason you do not wish to update to v6.XX of MPLAB, then this guide is to help with integrating your HI-TECH compiler with v5.70 of MPLAB. Although the compilers are compatible with previous versions of MPLAB, it is recommended that you use v5.70 as it is the most up-to-date version prior to the release of MPLAB v6.xx.
Firstly, if you have not already done so, download v5.70 of MPLAB. MPLAB is freely available from Microchip's web site. To install, run the downloaded installer and follow the prompts.
Next, install the compiler also by running the installer and following the prompts. Refer to the compiler's quick start guide for specific details.
Windows NT, 2000 and XP users should install the compiler while logged in with Administrator privileges.
After installation, the compiler will run in demo mode and will expire in 21 days. In demo mode, some command line options are disabled, compilation is delayed. These are the only restrictions. You can still build projects, integrate with MPLAB, etc... in demo mode in the same way as the full release version. The demo mode restrictions can be removed if the compiler has been purchased and your details have been registered with us. Upon registration, you will receive your compiler's activation key via email.
To activate your compiler after receiving a key, run the Compiler Activation program located in the compiler's installation directory. For help on compiler activation with PICC v8.02 or higher, click here.
The default compiler options that are available with MPLAB are not quite complete and can cause problems in complex projects. You can update the compiler options in MPLAB by using one of the below updates:
For user's of HI-TECH PICC v8.00 or higher, PICC Lite and HI-TECH PICC-18 v8.12PL1 or higher:
- htmplab5.exe (35 KB)
If you are using an earlier version of the PICC or PICC-18 compiler:
- htmplab4.exe (90 KB)
Depending on which version of the compiler you are using, the compiler may configure MPLAB automatically during installation. Regardless of this, it is best to manually configure MPLAB so as to be certain everything is correct.
![]() click to enlarge |
|
Note that this should only need to be done once, unless you upgrade MPLAB or reinstall your compiler in a different directory.
In order for MPLAB v5.70 to display error/warning messages in its window, it requires the error/warning messages to be in the appropriate place (an error file) and in the format that it understands. The error/warning message format is configured by setting two environment variables as shown below:
HTC_ERR_FORMAT=Error[000] %f %l : %s
HTC_WARN_FORMAT=Warning[000] %f %l : %s
The method by which you set an environment variable differs depending on which version of Windows you are running. On the older Windows 95/98 it is done in an AUTOEXEC.BAT file. In Windows NT/2000/XP is can be done via the control panel. Refer to Microsoft's help for details about doing this with your version of Windows. FAQ #78 has more information about this.
In addition to having the messages in the correct format, they must appear in an error file. This is configured for each project you make and is described in the next section.
|
![]() click to enlarge |
![]() click to enlarge |
|
|
![]() click to enlarge |
If you are using the MPLAB ICD, make sure you choose Compile for MPLAB ICD in the compiler options. This must be selected for ALL nodes of your project.
If you want to use 32-bit floating point numbers, make sure you choose Floating point for doubles: 32-bit in the compiler options for ALL nodes of your project. Be consistent in selecting 32-bit doubles, do not select 24-bit for one file and 32-bit for another.
Be careful when selecting your build options as some of the options offered will guarentee MPLAB reporting a build failure. The reason for this is that some options do not follow though to the link stage. So unless it is your explicit intention to do so, DO NOT select any of these options:
-S (compile to assembly only),
-PROTO (generate function prototypes)
-PRE (generate preprocessed source)
When configuring the compiler options it can be very useful (for debugging purposes) to generate an assembler list file and a map file. Assembler list files contain a mixture of your original C source code and the generated assembler code. Map files contain all information about how your code has been positioned in memory. Map files also contain a call graph which shows your stack usage.
If you are having problems with your program fitting into the available ROM/FLASH space, don't forget to turn on the compiler's optimizations. Compiler optimizations will attempt to reduce your program's code requirements without effecting the way it operates. There are two types of optimizations: global optimizations and assembler optimizations. To enable these, select them in the compiler options for each file of your project.
Now that your project has all of its files and your build options have been set up, it is now ready to be built.
|
![]() click to enlarge |
If your program builds successfully, the compiler should generate a HEX file and a COD file. The COD file contains all the information necessary for high-level debugging. You may notice that some complex types are not able to be viewed in the watch window. This is a limitation of the COD file format and MPLAB. Microchip have improved this in MPLAB v6.XX (via the use of COF files) and if you require better debugging, it is recommended that you update to it.
Copyright © 2008 HI-TECH Software • Trademarks
Site Map