Digital subsystems transfer digital or logical values in bits via digital lines. You can perform clocked and non-clocked digital operations using the DataAcquisition interface in the Data Acquisition Toolbox™.
Add lines of the digital subsystem as channels to your DataAcquisition using
addbidirectional. 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 read or write data. You can set the direction to
Output. By default the direction is
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 DataAcquisition.
If your device does not have an on-board clock you can:
Import a clock from an external source. See Acquire Digital Data Using an External Clock for more information.
Generate a clock from a Counter Output subsystem in your DataAcquisition and import that clock. See Acquire Digital Data Using a Counter Output Channel as External Clock for more information.
Share a clock from the analog input subsystem. See Acquire Digital Data Using a Shared Clock for more information.
This example shows how to access the device digital subsystem
information and find line and port information using
Find devices connected to your system and find the NI model USB-6509 device.
dev = daqlist("ni")
dev = 2×4 table DeviceID Description Model DeviceInfo ________ ___________________________________ __________ _______________________ "Dev2" "National Instruments(TM) USB-6509" "USB-6509" [1×1 daq.ni.DeviceInfo] "Dev3" "National Instruments(TM) USB-6211" "USB-6211" [1×1 daq.ni.DeviceInfo]
View the subsystem information in the
Dev2 using index
DevInf = dev.DeviceInfo(1)
DevInf = ni: National Instruments(TM) USB-6509 (Device ID: 'Dev2') Digital IO supports: 96 channels ('port0/line0' - 'port9/line7') 'InputOnly','OutputOnly','Bidirectional' measurement types