This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Acquire Voltage Data Using a Digital Trigger

This example shows how to use a falling edge digital trigger, which occurs when a switch closes on an external source. The trigger is connected to terminal PFI0 on device Dev1 and starts acquiring sensor voltage data.

Create a data acquisition session and add channels.

 s = daq.createSession('ni');

Add one voltage input channel from NI USB-6211 with device ID 'Dev1'.


Connect the switch to terminal 'PFI0' on NI USB-6211. The trigger comes from the switch, which is an external source.

ans =

Start Trigger is provided externally and will be received by 'Dev1' at terminal 'PFI0'.

     TriggerType: 'Digital'
TriggerCondition: RisingEdge
          Source: 'External'
     Destination: 'Dev1/PFI0'
            Type: StartTrigger

Set TriggerCondition property to 'FallingEdge'.

c = s.Connections(1);
c.TriggerCondition = 'FallingEdge';

Acquire data and store it in dataIn. The session waits for the trigger to occur, and starts acquiring data when the switch closes.

dataIn = startForeground(s);  

Related Examples

More About