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.

generate a clock. If there is no data to send just do a spi_read_16(0) to get the<br />

clock.<br />

If this device is a slave then either call spi_read_16() to wait for the clock and data<br />

or use_spi_data_is_in() to determine if data is ready.<br />

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

Requires:<br />

Examples:<br />

Example<br />

Files:<br />

Also See:<br />

NThat the option SPI_MODE_16B be used in setup_spi() function, or that the<br />

option XFER16 be used in #use SPI(<br />

data_in = spi_read_16(out_data);<br />

None<br />

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

spi_speed<br />

Syntax:<br />

Parameters:<br />

Returns:<br />

Function:<br />

Availability:<br />

Requires:<br />

Examples:<br />

Example Files:<br />

Also See:<br />

spi_speed(baud);<br />

spi_speed(stream,baud);<br />

spi_speed(stream,baud,clock);<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 set the SPI module to<br />

clock- the current clock rate to calculate the band rate with.<br />

If not specified it uses the value specified in #use delay ().<br />

Nothing.<br />

Sets the SPI module's baud rate to the specified value.<br />

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

#USE SPI<br />

spi_speed(250000);<br />

spi_speed(SPI1_MODE0, 250000);<br />

spi_speed(SPI1_MODE0, 125000, 8000000);<br />

None<br />

#USE SPI, spi_xfer(), spi_xfer_in(), spi_prewrite(), spi_init()<br />

316

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

Saved successfully!

Ooh no, something went wrong!