Data Acquisition Toolbox | ![]() ![]() |
Add hardware lines to a digital I/O object
Syntax
lines = addline(obj,hwline,'
direction
')
lines = addline(obj,hwline,port,'
direction
')
lines = addline(obj,hwline,'
direction
','names')
lines = addline(obj,hwline,port,'
direction
','names')
Arguments
Description
adds the hardware lines specified by lines = addline(obj,hwline,'
direction
')
hwline
to the digital I/O object obj
. direction
configures the lines for either input or output. lines
is a row vector of lines.
adds the hardware lines specified by lines = addline(obj,hwline,port,'
direction
')
hwline
from the port specified by port
to the digital I/O object obj
.
adds the hardware lines specified by lines = addline(obj,hwline,'
direction
','names')
hwline
to the digital I/O object obj
. names
is a descriptive line name or cell array of descriptive line names.
adds the hardware lines specified by lines = addline(obj,hwline,port,'
direction
','names')
hwline
from the port specified by port
to the digital I/O object obj
. direction
configures the lines for either input or output. names
is a descriptive line name or cell array of descriptive line names.
Rules for Adding Lines
hwline
depend on the hardware you access. For National Instruments and Measurement Computing hardware, line IDs are "zero-based" (begin at zero).
HwLine
property and the associated MATLAB indices are stored in the Index
property.
addline
, you can add multiple lines from one port or the same line ID from multiple ports. You cannot add multiple lines from multiple ports.
More About MATLAB Indices
Every hardware line contained by a device object has an associated MATLAB index that is used to reference the line. Index assignments are made automatically by addline
and follow these rules:
More About Descriptive Line Names
You can assign hardware lines descriptive names, which are stored in the LineName
property. Choosing a unique descriptive name can be a useful way to identify and reference lines. For a single call to addline
, you can
If the number of names specified in a single addline
call is more than one but differs from the number of lines to be added, then an error is returned. If a line is to be referenced by its name, then that name must not contain symbols. If you are naming a large number of lines, then the makenames
function might be useful. If a line is not assigned a descriptive name, then it must be referenced by index.
Example
Create the digital I/O object dio
and add the first four hardware lines (line IDs 0-3) from port 0.
These lines are automatically assigned the indices 1-4. If you want to add the first four hardware lines to dio
and assign descriptive names to the lines,
Note that you can use the makenames
function to create a cell array of line names. You can add the first four hardware lines (line IDs 0-3) from port 1 to the existing line group.
The new lines are automatically assigned the indices 5-8.
Functions
Properties
![]() | addchannel | addmuxchannel | ![]() |