Documentation Center

  • Trial Software
  • Product Updates

Acquire Clocked Digital Data with Shared Clock

This example shows how to share the clock with the analog input subsystem on your device with the digital subsystem and acquire automatically synchronized clocked data. You do not need any physical connections to share the clock. For information on automatic synchronization see Automatic Synchronization.

Create a session and add a line from port 0 line 2 on Dev1.

s = daq.createSession('ni');
addDigitalChannel(s,'Dev1','Port0/Line2','InputOnly')

Add an analog input channel to your session.

addAnalogInputChannel(s,'Dev1',0,'Voltage')
ans =

Data acquisition session using National Instruments hardware:
   Will run for 1 second (1000 scans) at 1000 scans/second.
   Number of channels: 2
      index Type Device   Channel   MeasurementType      Range       Name
      ----- ---- ------ ----------- --------------- ---------------- ----
      1     dio  Dev1   port0/line2 InputOnly       n/a
      2     ai   Dev1   ai0         Voltage (Diff)  -10 to +10 Volts

Plot the acquired digital data.

dataIn = startForeground(s);
plot (dataIn(:,1))

Alternate Digital Clocked Operations

You can also perform clocked operations when you :

Was this topic helpful?