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.

The pins must be specified with DI, DO, CLK or SPIx, all other options are<br />

defaulted as indicated above.<br />

Examples:<br />

#use spi(DI=PIN_B1, DO=PIN_B0, CLK=PIN_B2, ENABLE=PIN_B4, BITS=16)<br />

// uses software SPI<br />

#use spi(FORCE_HW, BITS=16, stream=SPI_STREAM)<br />

// uses hardware SPI and gives this stream the name SPI_STREAM<br />

Example<br />

Files:<br />

Also See:<br />

None<br />

spi_xfer()<br />

#use standard_io<br />

Syntax:<br />

Elements:<br />

Purpose:<br />

#USE STANDARD_IO (port)<br />

port is A, B, C, D, E, F, G, H, J or ALL<br />

This directive affects how the compiler will generate code for input and output<br />

instructions that follow. This directive takes effect until another #USE XXX_IO directive<br />

is encountered. The standard method of doing I/O will cause the compiler to generate<br />

code to make an I/O pin either input or output every time it is used. On the 5X<br />

processors this requires one byte of RAM for every port set to standard I/O.<br />

Standard_io is the default I/O method for all ports.<br />

When linking multiple compilation units be aware this directive only applies to the current<br />

compilation unit.<br />

Examples:<br />

Example<br />

Files:<br />

Also See:<br />

#use standard_io(A)<br />

ex_cust.c<br />

#USE FAST_IO, #USE FIXED_IO, General Purpose I/O<br />

#use timer<br />

Syntax:<br />

Elements:<br />

#USE TIMER (options)<br />

TIMER=x<br />

Sets the timer to use as the tick timer. x is a valid timer that the PIC has. Default<br />

value is 1 for Timer 1.<br />

146

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

Saved successfully!

Ooh no, something went wrong!