spi
Create SPI object
Description
An spi
object represents a connection between MATLAB® and an SPI controller board. Supported controllers are the Total Phase®
Aardvark I2C/SPI™ Host Adapter and the NI™ USB-8451 or USB-8452 I2C/SPI Interface Device.
Creation
Description
s = spi(
constructs an vendor
,boardIndex
,port
)spi
object associated with vendor
,
boardIndex
, and port
.
vendor
must be set to either 'aardvark'
, for use
with a Total Phase
Aardvark™, or to 'ni845x'
, for use
with the NI USB-845x controller board, to use this interface.
boardIndex
specifies the board index of the hardware and is usually
0
. port
specifies the port number within the
device and must be set to 0
.
SPI, or Serial Peripheral Interface, is a synchronous serial data link standard that operates in full duplex mode. Instrument Control Toolbox™ SPI support lets you open connections with individual chips and to read and write over the connections to individual chips using an Aardvark controller.
The primary uses for the spi
interface involve the
write
, read
, and
writeAndRead
functions for synchronously reading and writing binary
data. To identify SPI devices in the Instrument Control Toolbox, use the instrhwinfo
function on the SPI interface,
called spi
.
Once the SPI object is created, there are properties that can be used to change communication settings. These includes properties for clock speed, clock phase, and clock polarity. For a list of all the properties and information about setting them, see Using Properties on the SPI Object.
Input Arguments
Object Functions
read | Read binary data from SPI instrument |
write | Write binary data to SPI instrument |
writeAndRead | Write and read binary data from SPI instrument |
Examples
Version History
Introduced in R2013b