Digital subsystems transfer digital or logical values in bits via digital lines. You can perform clocked and non-clocked digital operations using the session-based interface in the Data Acquisition Toolbox™.
Lines on the digital subsystem are added as channels to your session using addDigitalChannel. Digital channels can be:
InputOnly: Allows you to read digital data.
OutputOnly: Allows you to write digital data.
Bidirectional: Allows you to change the direction of the channel to both read and write data. By default the direction is specified as Unknown. You can change the direction to Input or Output.
Note: If you are using bidirectional channels, you must set the Direction before you use the channel.
With clocked operations, you can acquire or generate clocked signals at a specified scan rate for a specified duration or number of scans. These operations use hardware timing to acquire or generate at specific times. The operation is controlled by events tied to subsystem clocks. In a clocked acquisition, data is transferred from the device to your system memory and displays when the event calls for the data. In signal generation, data generated from the device is stored in memory until the configured event occurs. When an event occurs, data is sent via the digital channels to the specified devices.
Digital systems do not inherently have a clock. You can synchronize data by adding a clock in one of these ways:
If you have an on-board clock on your device, you can import the clock to the session.
If your device does not have an on-board clock you can:
Import a clock from an external source. See Acquire Clocked Digital Data with Imported Clock for more information.
Generate a clock from a Counter Output subsystem in your session and import that clock. See Acquire Digital Data Using Counter Channels for more information.
Share a clock from the analog input subsystem. See Acquire Clocked Digital Data with Shared Clock for more information
This example shows how to access the device's digital subsystem information and find line and port information using daq.getDevices.
Find devices connected to your system and find the ID for NI 6255.
d = daq.getDevices;
d = Data acquisition devices: index Vendor Device ID Description ----- ------ --------- ----------------------------- 1 ni Dev1 National Instruments USB-6255 2 ni Dev2 National Instruments USB-6363
View the subsystem information for Dev1, with index 1.
subs = d(1).Subsystems;
View the digital subsystem information, which is the third subsystem on this device.
ans = Digital subsystem supports: 24 channels ('port0/line0' - 'port2/line7') 'InputOnly','OutputOnly','Bidirectional' measurement types