Documentation Center

  • Trial Software
  • Product Updates

Acquire Clocked Digital Data with Imported Clock

This example shows how to acquire digital data in the foreground by importing an external scan clock.

You can use a function generator or the on-board clock from a digital circuit. Here, a function generator is physically wired to the terminal PFI9 on device NI 6255.

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

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

Set the rate of your session to the expected rate of your external scan clock.

s.Rate = 1000

    Note:   Importing an external clock does not automatically set the rate of your session. Manually set the session's rate to match the expected external clock frequency.

Add an external scan clock to your device on terminal PFI9. For more information see Terminals property.

addClockConnection(s,'External','Dev1/PFI9','ScanClock')
ans =


Scan Clock is provided externally and will be received by 'Dev1' at terminal 'PFI9'.

       Source: 'External'
  Destination: 'Dev1/PFI9'
         Type: ScanClock

Acquire clocked data and plot it.

dataIn = startForeground(s);
plot (dataIn)

Alternate Digital Clocked Operations

You can also perform clocked operations when you :

Was this topic helpful?