ni845x
Description
An ni845x object represents a connection to a NI™ USB-8451 or USB-8452 I2C/SPI Interface Device. The NI USB-845x controller can have one or more I2C peripheral devices connected to it.
To configure and communicate with a peripheral device on the NI USB-845x controller, you must first create an ni845x object and
then use the device
function. You can connect to multiple peripheral devices with a single ni845x
object. The ni845x object in MATLAB® always has the I2C controller role and cannot be used in the peripheral
role.
Note
To use the ni845x interface, you must have the Instrument Control Toolbox™ Support Package for National Instruments™ NI-845x I2C/SPI Interface installed. For more information, see Install Instrument Control Toolbox Support Package for National Instruments NI-845x I2C/SPI Interface.
Creation
Syntax
Description
controller = ni845x( creates a
connection to the NI USB-8451 or USB-8452 I2C/SPI Interface Device specified by the serial number
serialNumber)serialNumber. You can find the serial number for your NI USB-845x controller by calling ni845xlist.
The input serialNumber sets the SerialNumber property.
controller = ni845x(
creates a connection to the NI USB-845x controller board and sets properties using one or more name-value
arguments. Set the VoltageLevel, EnablePullupResistors, and OutputDriverType properties using name-value arguments as
serialNumber,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. If you do not set the value of any of these properties using name-value arguments,
MATLAB sets them to their default value. You can change the values of these
properties later using dot notation.
controller = ni845x, without arguments, attempts to create a
connection to the last successfully connected NI USB-845x controller board. If you changed the values of the
VoltageLevel, EnablePullupResistors, or
OutputDriverType properties in your previous connection, the
modified values are maintained when you connect again. If you have not previously
connected to an NI USB-845x controller, using this syntax creates a connection to the first
available controller in the ni845xlist output.
Properties
Object Functions
configureDigitalPin | Set digital pin mode on controller |
readDigitalPin | Read logic level value of digital pin on controller |
writeDigitalPin | Write logic level value to digital pin on controller |
scanI2CBus | Scan for I2C peripheral devices connected to controller board |
Examples
Version History
Introduced in R2023aSee Also
ni845xlist | ni845xfind | aardvark | scanI2CBus | device