You are on page 1of 4

Transition Guide for the

dsPIC /PIC24 Compiler


®

CCS PCD Compiler


revised: 25-JUL-07
DATA

The PCD compiler defaults an int to a int16. A short is 8 bits and a long is 32 bits.
In addition the default for all ints is SIGNED. To make the types work in PCD the way
they do in the other CCS compilers use:
#TYPE CLASSIC
The PCD compiler adds the integer types int48 and int64. In addition there are two new float-
types float48 and float64 (aka double). The float32 (aka float) format has been changed
in PCD to use the IEEE format instead of the Microchip format. This is the same format-
Microchip uses in their C30 compiler.
SPECIFICS

Code size and run time will be most effective if you stick with only one float type throughout
your program.

The 24-bit opcode parts work best when dealing with an int16. There is an additional over-
head in most cases when doing an int8 operation.

Many built in functions that returned an int8 value in the other CCS compiler now return an
int16.

The 24-bit opcode parts do not have RAM banking like the other PIC parts. The first 8K of
RAM can be equally accessed by most instructions and the remaining RAM can only be
accessed by a less efficient means.

For DSP work RAM is split into two areas (X and Y). The #BANKX and #BANKY directives
are used to put variables into a specific area. DSP instructions require certain operands
to be in a particular area.
ASSEMBLY
The assembly instructions do not resemble the traditional PIC instructions. The compiler
inline assembly feature will accept assembly in the published Microchip format.
SPECIFICS

In PCW use OPTIONS > PROJECT OPTIONS > FILE FORMATS to select “Interpret”
and an interpretation of the assembly instructions will be added to the LST file. This can be
helpful to those not expert in the assembly. This can be especially helpful for instructions
that use implied registers.

In the same window the SFR option can be used to show the Special Function Register
names in the LST file.

BUILT-IN FUNCTIONS
SPECIFICS

Many built-in functions that deal with peripherals have changed in the PCD compiler. How-
ever, where possible, the names are the same and the constants used are similar.

The PCD Help File is accessed in PCW when the 24-bit compiler is selected in the Compile
ribbon.
PROGRAM MEMORY

Each instruction takes 24 bits. Memory is addressed by word. This means two addresses
are used for each instruction however there are only 3 bytes in those two addresses.

The functions read/write _program_memory will copy data and every 4th byte is blank.
SPECIFICS

For rom data defined like this:


rom char table[] = {“helow world”};

The compiler packs the constant data into the memory and when an address is resolved to
the running program a fake byte address is used. The compiler translates this address in
the built-in functions.

When CONST is used the data is saved in a more efficient manor for faster reading however
pointers can not be used (only indexes) on this data.

You might also like