- math library
- installation and
- supported chips
Frequent Asked Questions
1. I have problems using the compiler on MPLAB version 6 and
a) After entering or changing path names for the language toolsuite ("Project->Select Language Toolsuite"), MPLAB may need to be closed and restarted before the newly entered names are used.
b) MPLAB does not supply source file path when starting the compiler, which means that the C files and project files must reside on the same folder.
c) The include files path $(INCDIR) found on "Project->Build Options->Project" need doublequotes ("...") if the path names contain spaces. Also, do not use a backslash+doublequote (\") at the end of the path name because the options forwarded to the compiler will not be right then.
d) Before using MPLINK in combination with the compiler, please read compiler file LINKER.TXT, line 485, "MPLAB SUPPORT". It is recommended to try the linker example found in LINKER.TXT first.
e) Copying the MPLAB project files to a folder different from the one where the project was created may cause problems. Copying the source files and creating a new project is probably better.
2. MPLAB prints the error message "The format of the
file C:..\..\myprogram.HEX can not be read or written because its extension was not
recognized". How can it be solved?
regsvr32 "C:\Program Files\MPLAB IDE\dlls\MPProgram.dll"
3. What does "WARNING: String limit (64) in COD file
4. I get "System error" when installing CC5X.
In a MSDOS window environment variables can be inspected by using command: SET
To inspect a environment variable TMP you can use: SET TMP
In Windows you can inspect environment variables from the following "path" (depends on the language on your computer):
IMPORTANT: If the path name of the environment variable use "extended" ASCII codes, then the encoding of these could be different in a MSDOS window and the remaining WINDOWS. An example of an extended ASCII character is 'ã'. An extended ASCII character could look correct, but if the encoding is different, then the path is wrong when programs try to use it.
The problem with different ASCII character encoding can be solved by setting the TMP (TEMP) environment variable to another folder, or updating the path (editing it). The compiler installation program will use TMP to store temporary files which are deleted after the installation. In addition, information about the installation is stored to allow automatic uninstall, and also previous installation overwriting when installing a new version. When this information is missing, the CC5X folder and files have to be deleted manually to remove the compiler from the computer.
5. The address for some local variables and function
parameters seem to be wrong.
The unallocated variables are truncated to the same location. When using command line option -V there will be a mark at the unallocated local variables (file <xxx>.VAR). By using the -wU command line option a warning is printed for each uncalled function.
The following pragma will remove all unused routines if placed in the beginning of the program:
#pragma library 1
Also note that all extern functions are separate call trees when using relocatable assembly. This separate allocation requires more RAM space.
6. How do I solve the error message "Shared function
'xxx' contains local variables or parameters"?
Using static locations is fast and efficient. However, at interrupt, there may be a collision if the same routine is called (from main and interrupt) because the local variables and parameters could be overwritten causing wrong results in the calculation in main. The local variables could be saved at interrupt, but this is not implemented, and there could be many locations to save. There could be other solutions that could be managed by the compiler, but there seem to be many difficulties with all of them.
Some application writers use "interrupt driven processing" where the interrupt function become large and takes time to process. This kind of program structure easily runs into the above problem. Another way to write the application is to let the interrupt function finish as fast as possible and leave to processing to the main routine. This could be done by flags (bit variables) that are set in the interrupt routine, and read and cleared in the main program. This program structuring also makes it easier to ensure that interrupts are not lost because little time is spent in the interrupt routine.
#pragma inlineMath 1
Another challenge is 'const' data which use a common routine to read the data. A solution is to access const data from interrupt using the #pragma return array described in Chapter 9.2 in the Users Manual, and in file 'c-goto.txt'.
7. I got error message: "OPTION ERROR: Duplicate file
name or option error 'Files\bknd\CC5X' ".
8. How do I define the symbol ICD2_DEBUG ?
9. Why does debugging not work in MPLAB 6.43 - 6.60?
Solution 1: Modify the TLCC5X.INI file in the folder LegacyLanguageSuites found in the MPLAB installation folder, line 9, from "Target=HEX to "Target=COD". This also require using the -CC or -CA command line option at compilation, otherwise MPLAB will say "Build Failed".
Solution 2: Select "File -> Import" after a compilation, then set the file type to "Debug Files (*.cof;*.cod)" and look up the newly generated COD file and click the "Open" button. Single step and breakpoints are then available. The "import file" procedure have to be repeated after a new compilation.
10. How do I define a new PICmicro?
11. How do I set up CC5X for MPLAB?
12. How do I use code pages?
13. How do I use RAM banks?
14. Are there any known bugs?
15. The code generated for the switch statement looks wrong.