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.

Purpose:<br />

Examples:<br />

Example<br />

Files:<br />

Also See:<br />

DEFINE=id<br />

Creates a define named id which specifies the number of capture per<br />

second. Default define name if not specified is<br />

CAPTURES_PER_SECOND. Define name must start with an ASCII<br />

letter 'A' to 'Z', an ASCII letter 'a' to 'z' or an ASCII underscore ('_').<br />

This directive tells the compiler to setup an input capture on the<br />

specified pin using the specified settings. The #USE DELAY directive<br />

must appear before this directive can be used. This directive enables<br />

use of built-in functions such as get_capture_time() and<br />

get_capture_event().<br />

#USE<br />

CAPTURE(INPUT=PIN_C2,CAPTURE_RISING,TIMER=1,FASTEST)<br />

None.<br />

get_capture_time(), get_capture_event()<br />

#use delay<br />

Syntax:<br />

Elements:<br />

#USE DELAY (options))<br />

Options may be any of the following separated by commas:<br />

clock=speed speed is a constant 1-100000000 (1 hz to 100 mhz).<br />

This number can contains commas. This number also supports the following<br />

denominations: M, MHZ, K, KHZ. This specifies the clock the CPU runs at. Depending<br />

on the PIC this is 2 or 4 times the instruction rate. This directive is not needed if the<br />

following type=speed is used and there is no frequency multiplication or division.<br />

type=speed type defines what kind of clock you are using, and the following values are<br />

valid: oscillator, osc (same as oscillator), crystal, xtal (same as crystal), internal, int<br />

(same as internal) or rc. The compiler will automatically set the oscillator configuration<br />

bits based upon your defined type. If you specified internal, the compiler will also<br />

automatically set the internal oscillator to the defined speed. Configuration fuses are<br />

modified when this option is used. Speed is the input frequency.<br />

restart_wdt will restart the watchdog timer on every delay_us() and delay_ms() use.<br />

clock_out when used with the internal or oscillator types this enables the clockout pin to<br />

output the clock.<br />

fast_start some chips allow the chip to begin execution using an internal clock until the<br />

primary clock is stable.<br />

lock some chips can prevent the oscillator type from being changed at run time by the<br />

software.<br />

USB or USB_FULL for devices with a built-in USB peripheral. When used with the<br />

134

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

Saved successfully!

Ooh no, something went wrong!