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 />

will be clocked out and the data received will be returned. If no data is ready,<br />

spi_read() will wait for the data is a SLAVE or return the last DATA clocked in<br />

from spi_write().<br />

If this device is the MASTER then either do a spi_write(data) followed by a<br />

spi_read() or do a spi_read(data). These both do the same thing and will<br />

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

clock.<br />

Availability:<br />

Requires:<br />

Examples:<br />

Example Files:<br />

Also See:<br />

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

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

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

Nothing<br />

data_in = spi_read(out_data);<br />

ex_spi.c<br />

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

spi_read_16()<br />

spi_read2_16()<br />

spi_read3_16()<br />

spi_read4_16()<br />

Syntax:<br />

value = spi_read_16([data]);<br />

value = spi_read2_16([data]);<br />

value = spi_read3_16([data]);<br />

value = spi_read4_16([data]);<br />

Parameters: data – optional parameter and if included is a 16 bit int<br />

Returns:<br />

Function:<br />

A 16 bit int<br />

Return a value read by the SPI. If a value is passed to the spi_read_16() the data<br />

will be clocked out and the data received will be returned. If no data is ready,<br />

spi_read_16() will wait for the data is a SLAVE or return the last DATA clocked in<br />

from spi_write_16().<br />

If this device is the MASTER then either do a spi_write_16(data) followed by a<br />

spi_read_16() or do a spi_read_16(data). These both do the same thing and will<br />

315

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

Saved successfully!

Ooh no, something went wrong!