17.02.2015 Views

CCS C Compiler Manual PCB / PCM / PCH

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

PreProcessor<br />

NORETFIE<br />

to interrupt lower priority interrupts.<br />

ISR functions (preceeded by a #int_xxx) will use a<br />

RETURN opcode instead of the RETFIE opcode.<br />

This is not a commonly used option; used rarely in<br />

cases where the user is writing their own ISR<br />

handler.<br />

Both chip and options are optional, so multiple #DEVICE lines may be used to fully<br />

define the device. Be warned that a #DEVICE with a chip identifier, will clear all previous<br />

#DEVICE and #FUSE settings.<br />

Compilation mode selection-<br />

The #DEVICE directive supports compilation mode selection. The valid keywords are<br />

<strong>CCS</strong>2, <strong>CCS</strong>3, <strong>CCS</strong>4 and ANSI. The default mode is <strong>CCS</strong>4. For the <strong>CCS</strong>4 and ANSI<br />

mode, the compiler uses the default fuse settings NOLVP, PUT for chips with these<br />

fuses. The NOWDT fuse is default if no call is made to restart_wdt().<br />

<strong>CCS</strong>4<br />

ANSI<br />

<strong>CCS</strong>2<br />

<strong>CCS</strong>3<br />

<strong>CCS</strong>2<br />

only<br />

This is the default compilation mode. The pointer size in this mode for<br />

<strong>PCM</strong> and <strong>PCH</strong> is set to *=16 if the part has RAM over 0FF.<br />

Default data type is SIGNED all other modes default is UNSIGNED.<br />

Compilation is case sensitive, all other modes are case insensitive.<br />

Pointer size is set to *=16 if the part has RAM over 0FF.<br />

var16 = NegConst8 is compiled as: var16 = NegConst8 & 0xff (no sign<br />

extension) Pointer size is set to *=8 for <strong>PCM</strong> and <strong>PCH</strong> and *=5 for <strong>PCB</strong> .<br />

The overload keyword is required.<br />

The default #DEVICE ADC is set to the resolution of the part, all other<br />

modes default to 8.<br />

onebit = eightbits is compiled as onebit = (eightbits != 0)<br />

All other modes compile as: onebit = (eightbits & 1)<br />

Purpose:<br />

Chip Options -Defines the target processor. Every program must have exactly one<br />

#DEVICE with a chip. When linking multiple compilation units, this directive must appear<br />

exactly the same in each compilation unit.<br />

Compilation mode selection - The compilation mode selection allows existing code to<br />

be compiled without encountering errors created by compiler compliance. As <strong>CCS</strong><br />

discovers discrepancies in the way expressions are evaluated according to ANSI, the<br />

change will generally be made only to the ANSI mode and the next major <strong>CCS</strong> release.<br />

Examples:<br />

Chip Options-<br />

#device PIC16C74<br />

#device PIC16C67 *=16<br />

#device *=16 ICD=TRUE<br />

#device PIC16F877 *=16 ADC=10<br />

#device %f=.<br />

printf("%f",.5); //will print .5, without the directive it will print 0.5<br />

101

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!