17.02.2015 Views

CCS C Compiler Manual PCB / PCM / PCH

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Compilation mode selection-<br />

#device <strong>CCS</strong>2 // This will set the ADC to the resolution of the part<br />

Example<br />

Files:<br />

Also See:<br />

ex_mxram.c , ex_icd.c , 16c74.h ,<br />

read_adc()<br />

_device_<br />

Syntax:<br />

__DEVICE__<br />

Elements: None<br />

Purpose:<br />

Examples:<br />

Example<br />

Files:<br />

Also See:<br />

This pre-processor identifier is defined by the compiler with the base number of the<br />

current device (from a #DEVICE). The base number is usually the number after the<br />

C in the part number. For example the PIC16C622 has a base number of 622.<br />

#if __device__==71<br />

SETUP_ADC_PORTS( ALL_DIGITAL );<br />

#endif<br />

None<br />

#DEVICE<br />

#if expr #else #elif #endif<br />

Syntax:<br />

#if expr<br />

code<br />

#elif expr<br />

code<br />

#else<br />

code<br />

#endif<br />

//Optional, any number may be used<br />

//Optional<br />

Elements:<br />

Purpose:<br />

expr is an expression with constants, standard operators and/or preprocessor<br />

identifiers. Code is any standard c source code.<br />

The pre-processor evaluates the constant expression and if it is non-zero will<br />

process the lines up to the optional #ELSE or the #ENDIF.<br />

102

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

Saved successfully!

Ooh no, something went wrong!