| Data Acquisition Toolbox | Search  Help Desk |
| addline | Examples See Also |
Add hardware lines to a digital I/O object.
Syntax
lines = addline(obj, hwl);
lines = addline(obj, hwl, index);
lines = addline(obj, hwl, index, port);
lines = addline(obj, hwl, port);
lines = addline(obj, hwl, index, port, names);
lines = addline(obj, hwl, index, names);
lines = addline(obj, hwl, port, names);
Arguments
Description
addline adds hardware lines to an existing digital I/O device. The added lines constitute a line group. The values you supply for hwl depend on the hardware accessed. For National Instruments hardware, lines are "zero-based" (begin at zero). For Hewlett-Packard hardware, lines are "one-based" (begin at one). If in doubt, consult your hardware manual.
With every hardware line there is an associated MATLAB index that is used to reference the line. The index assignments follow these rules:
index is not specified, and no hardware lines are assigned to the object, then the assigned indices start at one and increase monotonically. If hardware lines have already been assigned to the object, then the assigned indices start at the next highest value and increase monotonically.
index is specified but the indices are previously assigned, then the requested assignment takes precedence and the previous assignment is reindexed to the next available values. If the lengths of hwch and index are not equal, then an error is returned and no lines are added to the device object.
names and hwl are not the same, then only those lines having a corresponding names entry are named. Line names must begin with a character and contain only characters, numbers, and underscores. If you are naming a large number of lines, then the makenames function may be useful. If a line is not assigned a descriptive name, then it must be referenced by index.
Examples
National Instruments
Suppose you created a digital I/O object calledDIO1 for a National Instruments board, and add the first four physical hardware lines (lines 0-3) from port 1.
DIO1 = digitalio('nidaq', 1)
addline(DIO1, 0:3);
These lines are automatically assigned the indices 1-4. You can associate descriptive names with these lines by passing a cell array of names.
addline(DIO1, 0:3, {'line1', 'line2', 'line3', 'line4'});
makenames function.
You can add lines 0-3 from port 2 to the existing line group.
addline(DIO1, 0:3, 2);
addline(DIO1, 0:3, 1:4, 2);
See Also
Functions
delete, makenames