device
Description
A device object represents a connection to an I2C peripheral
device on a Total Phase®
Aardvark™ or NI™ USB-845x controller board. You must first connect to the controller using
aardvark or
ni845x. Make
sure you have one or more I2C peripheral devices physically connected to the controller. After
you create a device object, communicate with it using read,
write,
readRegister,
and writeRegister.
Creation
Syntax
Description
peripheral = device(
creates a connection to a peripheral device with I2C address specified by
controller,I2CAddress=address)address on the controller specified by
controller. You can find the address for peripheral devices on the
controller using the scanI2CBus function.
The argument address sets the I2CAddress
property.
peripheral = device(
creates a connection and sets additional properties using one or more optional name-value
arguments. Set the BitRate
and ByteOrder
properties using name-value arguments as
controller,I2CAddress=address,Name=Value)Name1=Value1,...,NameN=ValueN, where Name is the
property name and Value is the corresponding value. Name-value
arguments must appear after other arguments, but the order of the arguments does not
matter.
Input Arguments
Properties
Object Functions
read | Read data from I2C peripheral device |
write | Write data to I2C peripheral device |
readRegister | Read data from I2C peripheral device register |
writeRegister | Write data to I2C peripheral device register |
Examples
Version History
Introduced in R2023a
See Also
aardvark | ni845x | scanI2CBus