Quickguide Ccs

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

CCS C COMPILER QUICKGUIDE

SANI IRWAN MD SALIM FKEKK, UTeM 7/1/2008

1 Introduction to CCS
The CCS C Compiler was developed exclusively for the PIC MCU - making it the most optimized compiler for Microchip parts. The compiler has a generous library of built-in functions, preprocessor commands, and ready-torun example programs to quickly jump-start any project. Drivers for real-time clocks, LCDs, A/D converters, and many more are innate features to the CCS C Compiler. The 24-bit compiler - PCD makes for easy migration from 8bit processors up to 24-bit processors with minimal user interaction. PCD has a generous CCS math function library, Flash access functions and the full range of common built-in functions and preprocessor commands that emphasize the need for a C compiler.

Figure 1 CCS C Compiler developed by Custom Computer Services, Inc.

There are several versions of compilers that represent the compatible families of Microchip ranging from 12-bit to 24bit. Figure 2 shows the corresponding versions with the supported IC.

Figure 2 Versions Available for CCS C Compiler

2 Setting Up Project Files & Program Codes


2.1 PIC C Compiler Interface
Click on the icon to open the PIC C Compiler program. Figure 3 shows the first interface of the IDE.

TOOLBARS

STARTING ORB

PROGRAMMING CODE AREA

FILE HIERARCHY

PROJECT FILE NAME

Figure 3 PIC C Compiler Interface

2.2 Open New File/Project


Click the orb>New>Source File and then type the name of the File/Project that you want to create. For this example, we use quickguide.c.

Figure 4 Create New File/Project

Figure 5 Select The File/Project Location and Name

2.3 Writing the codes


Now, the program coding can be typed in the programming code area. In this example, a running light program is used to show the basic structure of C programs. The structure includes: Header files: <type of PIC.h> Parameters: Clock frequency, setting fuses etc. Port definition: Fixed numbering for all I/O ports available for the PIC main() function and the program code.

Figure 6 Example of Program Code Running Light

2.4 Compile
When done, click on the Toolbar Compile>Build All to compile all of the code. The build function then will open up a window that summarizes all the compilation being done.

Figure 7 Build All Button

Figure 8 Compile Summary

Output window then is generated at the bottom of the screen indicating the location of error (if any). Do discard the warning sign and repair all the error stated in order to achieve successful compilation.

Figure 9 Output Windows

Among the output files generated by PIC C compiler, the most important file is the hex files (with *.hex extension). This file is needed by the programmer (such as WinPic) to program the microcontroller. The same hex file also can be used during Proteus VSM Simulation.

2.5 Compile Selected File


In a project, there could be several file open together. To compile the specific file, instead of compiling all the files, right-click on the file that you want to compile and click on Make File Project. Do check at the project name section to verify the file selected. Then you can compile the selected file as normal.

You might also like