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.

Built-in Functions<br />

spi_data_is_in( ) spi_data_is_in2( )<br />

Syntax:<br />

Parameters:<br />

Returns:<br />

Function:<br />

Availability:<br />

Requires:<br />

result = spi_data_is_in()<br />

result = spi_data_is_in2()<br />

None<br />

0 (FALSE) or 1 (TRUE)<br />

Returns TRUE if data has been received over the SPI.<br />

This function is only available on devices with SPI hardware.<br />

Nothing<br />

Examples:<br />

while ( !spi_data_is_in() && input(PIN_B2) );<br />

if( spi_data_is_in() )<br />

data = spi_read();<br />

Example Files:<br />

Also See:<br />

None<br />

spi_read(), spi_write(), SPI Overview<br />

spi_init()<br />

Syntax:<br />

Parameters:<br />

Returns:<br />

Function:<br />

Availability:<br />

Requires:<br />

spi_init(baud);<br />

spi_init(stream,baud);<br />

stream – is the SPI stream to use as defined in the STREAM=name<br />

option in #USE SPI.<br />

band- the band rate to initialize the SPI module to. If FALSE it will disable<br />

the SPI module, if TRUE it will enable the SPI module to the band rate<br />

specified in #use SPI.<br />

Nothing.<br />

Initializes the SPI module to the settings specified in #USE SPI.<br />

This function is only available on devices with SPI hardware.<br />

#USE SPI<br />

313

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

Saved successfully!

Ooh no, something went wrong!