Search this site (www.microchipC.com).





CCS C Compiler for Microchip PIC micros

Your ad here

 

Independent Review of the CCS C compiler

I've been using the Customer Computer Services (CCS) compiler for a while now. In the next few minutes, you will get a good overview of what the CCS C compiler is capable of.

On thing I was taken with is the C code wizard. Read on for why I fell in love with this feature ...

Description of the CCS C Compiler
Supplied IDE
Code Wizard In Action
Sample Code
Supplied Compiler Tools
Conclusion

ANSI compatible C compiler

The CCS C compiler supports the Microchip PIC12x, PIC16x, PIC18x, and dsPIC devices.

The compiler is very close to being 100% ANSI compatible. It supports everything a PIC compiler needs. It also supports the necessary superset of ANSI C to work with embedded micros, such as fuse and interrupt level support.

Supplied IDE

The supplied IDE is nicely integrated into the compiler.

The IDE is very configurable. All the menus can be customised. The programming icon defaults to the WARP-13 programmer, this can be changed in the options.

Here is a screenshot of the IDE, showing its look and feel.


Figure 1: Look and feel of the IDE

Code Wizard

The Code Wizard can be used to generate perfect template C code, tailored to each individual PIC micro.


Figure 2: Wizard setup for any particular PICxxxxx micro, and all its peripherals

Wizard for RS232 and I2C support

Its easy to add RS232 serial port and I2C support to your project. Select the appropriate options in the wizard file, click 'Generate', and the code is inserted into your project.


Figure 3: Wizard setup for RS232 and I2C

Wizard for External Chips Support

As part of the code wizard, one can add support for a variety of external chips. The currently supported chips are the Dallas DS1302 real time clock, LTC1298 A/D convertor, LCD drivers, EEPROM from 128bytes to 8kbytes, Philips PCF8570 serial RAM, and many more.


Figure 4: Wizard setup for interfacing to EEPROM, LCD, temperature sensors, external RAM, etc.

Wizard for Timers

One of the most datasheet-intensive jobs is setting up timers. With the wizard, select the appropriate timer and its frequency, and click 'Generate' for perfect C code to initialize the timer.


Figure 5: Wizard timer setup

Wizard for Ports Setup

The wizard allows you to set up port directions, and values.


Figure 6: Wizard ports setup

Wizard Conclusion

So far, I have mentioned 5 settings that the wizard sets up on the PIC micro. There are 6 more wizards, covering the rest of the peripherals on the particular PIC micro that you are working with.

The wizard is a good feature of the compiler tools, and saves a lot of typing.

Sample Code

CCS C comes with a lot of sample code - 70 complete projects, demonstrating everything from an internet web dedicated servers to USB connection. Every peripheral that the PIC micro has is demonstrated, in code.

Here is a selection of the sample code that it arrives with:

  • Simple web server for a PIC
  • Using the PIC16C765 for USB connection to a PC
  • Sample code demonstrating A/D samples output to a serial port
  • LCD sample code
  • Using the capture port
  • Example of talking to an X.10 compatible peripheral.
  • ... and over 60 more sample projects.

Tools: Program Statistics

Selecting "View>>Program Statistics" shows a list of interesting program statistics. There is even the stats stating the average number of instructions that each line of C compiles to.

Tools: Call Tree

Selecting the menu "View >> Call Tree" gives an list of the procedures called in the program. This is quite useful - on the 14-bit microcontrollers such as the PIC16F87x series, one must be careful not to have nested subroutines more than 12 calls deep.

Tools: File Comparison

Often, when programming, you'll need to compare versions of files to find out exactly what has changed. CCS includes a handy tool to make this conversion easier.

Of course, this feature has always been included in Windows and DOS - use the DOS command "C:\>FC [file1] [file2]" for file compare. However, this requires an exit to DOS and typing a lengthy command line. The tools included with CCS C to compare files are much better.


Figure 7: CCS File Comparison Tool

Tools: Hex Convertor

A lot of embedded programming involves working with hexadecimal. CCS includes a neat little tool under the menu "Tools >> Numeric Convertor" to convert between decimal, hexadecimal, and float data types.


Figure 8: CCS Hexadecimal Conversion Tool

Tools: Valid Fuses

When programming a PIC chip, the fuse settings must be set. For example, if a 20Mhz crystal is used, the fuse must be set to 'HS'. To set "Code Protection from External Reads", the fuse must be set to 'PROTECT'. An sample line of C, included before main() is shown next.

#fuses HS,PROTECT //fuse settings

A nice feature of CCS is the ability to find valid fuse settings for a particular micro. Simply select "View >> Valid Fuses" for a list.


Figure 9: View valid fuse settings for a PIC micro

Debugger

The IDE includes integrated support for a debugger. Attach 5 wires to your PIC micro, and then step through the C code on the target in real time.

Technical Support

I have found the technical support from CCS to be quick and accurate. Select "Help >> Technical Support", and your email software is started. For the last 2 enquiries that I sent, an auto-mailer responded instantly with a support ID code, followed by a email explaining what to do within 2 hours.

Advantages of CCS C

  • IDE is well thought out and user friendly.
  • Code Wizard for generating C code tailored to any PIC micro you may be working with.
  • Every tool and feature of the compiler is integrated cleanly into the IDE.
  • Quality of compiled code is excellent. The optimizer seems to make a good job of compressing the code.
  • Tech support is quick, accurate and responsive.
  • Lots of supplied sample C code. The supplied sample C code demonstrates a huge range of techniques and features for a good range of PIC micros.
  • Value for money is excellent, especially compared to other compilers such as IAR C.

Disadvantages of CCS C

  • I found the ordering process to be problematic - I had to download the files four times and rename them to get it to work. However, considering that the ordering process is only a once-off, this is not too bad.
  • The IDE crashed once. I forwarded the error details to the CCS C people, and they have fixed this problem. Apart from this, the IDE was stable and worked extremely well.

Conclusion

CCS have done a fine job on their compiler. If you are a hobbyist, or designing code in a commercial setting, then CCS C will be perfect for you.

Disclaimer

This is an independent review, not affiliated with Custom Computer Services. The views expressed in this article expressly those of Shane Tolmie.

Feedback

What do you think of this article? Send feedback to support@microchipc.com, and I will include your comments, for the world to see, at the base of this article.

Feedback

2008-04-08-1303 - Received email:

Shane Tolmie

I'd like to comment on the article "PIC18 Compiler Comparison - CCS, IAR, Hi-Tech and Microchip C18" located here:
http://www.microchipc.com/reviews/PIC18_compiler_comparison/


in response to:
"
However there is no way to do such an assignment in the CCS compiler their you have to call a internal function:
#define RA0 PIN_A0
output_high(RA0);

The net result is that if you want to keep your code portable to the CCS compiler you would need to do something like this for all the other compilers:

#define output_high(x) {x=1;}
Thus you would have to use the output_high function/macro anytime you set a bit.

[CCS have introduced a function in later versions which makes this CCS port assignment unnecessary - Ed.]
"


I have used the following method (example code provided) with success, removing the need to call the built in port manipulation functions in CCS:

"
#byte PORTC = 0x07 //PORTC is at SFR address 0x07
#define LED1 0x80 //LED1 on PORTC MSB

void main()
{
    while(1)
    {
        PORTC|=LED1; //Turn off LED1
        PORTC&=~LED1; //Turn off LED1
        PORTC^=LED1; //Toggle LED1
    }
}
"

I'm not sure how this method would port to other compilers, but this might help someone else.

Thanks,

Aaron Carlton

Contact

Custom Computer Services (CCS) Ltd.
http://www.ccsinfo.com/
info@ccsinfo.com

More Reviews

Review on Hi-Tech for PIC18x.
Review on Hi-Tech for PIC12x, 16x and 17x.



This site is non-profit. Ad revenue almost covers hosting costs.

We welcome any suggesions or comments! Send them to Shane Tolmie on support@microchipc.com. This site is a completely separate site to www.microchip.com, and is maintained independently of Microchip Ltd., manufacturers of the PIC micro. All code on this site is free for non-commercial use, unless stated otherwise. Commercial use normally free, however, it is prohibited without contacting support@microchipc.com for permission. All content on this site created by Shane Tolmie is copyrighted by Shane Tolmie 1999-2009. Click to advertise on this website - $29.90 for a banner ad which will reach 55,000 user sessions per month. One months free trial!