Data Acquisition Toolbox | ![]() ![]() |
Line and Port Characteristics
As described in the preceding section, when you add lines to a digital I/O object, they must be configured for either input or output. You read values from an input line and write values to an output line. Whether a given hardware line is addressable for input or output depends on the port is resides on. You can classify digital I/O ports into these two groups based on your ability to address lines individually:
You can add any number of available port-configurable lines to a digital I/O object. However, the engine will address all lines behind the scenes. For example, if one line is added to a DIO object, then you automatically get all lines. This means that if a digital I/O object contains lines from a port-configurable device, and you write a value to one or more of those lines, then all the lines are written to even if they are not contained by the device object.
You can return the line and port characteristics with the daqhwinfo
function. For example, National Instruments AT-MIO-16DE-10 board has four ports and eight digital I/O lines per port. To return the digital I/O characteristics for this board
hwinfo = daqhwinfo(dio);
To display the line and port characteristics for the first port
hwinfo.Port(1) ans = ID: 0 LineIDs: [0 1 2 3 4 5 6 7] Direction: 'in/out' Config: 'line'
To display the line and port characteristics for the second port
hwinfo.Port(2) ans = ID: 2 LineIDs: [0 1 2 3 4 5 6 7] Direction: 'in/out' Config: 'port'
To display the line and port characteristics for the third port
hwinfo.Port(3) ans = ID: 3 LineIDs: [0 1 2 3 4 5 6 7] Direction: 'in/out' Config: 'port'
To display the line and port characteristics for the fourth port
hwinfo.Port(4) ans = ID: 4 LineIDs: [0 1 2 3 4 5 6 7] Direction: 'in/out' Config: 'port'
This information tells you that you can configure all 32 lines for either input or output, and that the first port is line-configurable while the remaining ports are port-configurable.
![]() | Adding Lines to a Digital I/O Object | Referencing Individual Hardware Lines | ![]() |