Main Content

addtrigger

Add trigger connection to device interface

Since R2020a

Description

addtrigger(d,"Digital","StartTrigger",trigSrc,trigDest) adds a trigger connection to the DataAcquisition interface. The created connection is appended to the DigitalTriggers property of the DataAcquisition object.

trg = addtrigger(___) adds the trigger and returns the trigger object.

[trg,idx] = addtrigger(___) adds the trigger and returns the trigger object and the trigger index from the DataAcquisition interface.

example

Examples

collapse all

Add triggers to a DataAcquisition interface in various configurations.

Add a trigger shared between two devices.

d = daq("ni");
addinput(d,"Dev1","ai0","Voltage")
addinput(d,"Dev2","ai0","Voltage")
addtrigger(d,"Digital","StartTrigger","Dev1/PFI0","Dev2/PFI0")

Add a trigger imported from an external source.

d = daq("ni");
addinput(d,"Dev1","ai0","Voltage")
addtrigger(d,"Digital","StartTrigger","External","Dev1/PFI0")

Add a trigger exported to an external destination.

d = daq("ni")
addinput(d,"Dev1","ai0","Voltage")
addtrigger(d,"Digital","StartTrigger","Dev1/PFI0","External")

Add a trigger from an external source supplied at terminal PXI_Trig0.

d = daq("ni");
addinput(d,"PXI1Slot5",0,"Voltage")
addtrigger(d,"Digital","StartTrigger","External","PXI1Slot5/PXI_Trig0")

Add a trigger from an external source supplied at terminal PXI1Slot5/PXI_Star.

d = daq("ni");
addinput(d,"PXI1Slot5",0,"Voltage")
addtrigger(d,"Digital","StartTrigger","External","PXI1Slot5/PXI_Star")

Input Arguments

collapse all

DataAcquisition interface, specified as a DataAcquisition object, created using the daq function.

Example: d = daq()

Trigger signal source, specified as a string or character vector indicating a device terminal, or "external" when importing a terminal from an external source.

Example: "external"

Data Types: char | string

Trigger signal destination, specified as a string or character vector indicating a device terminal, or "external" when exporting a trigger to an external destination.

Example: "external"

Data Types: char | string

Output Arguments

collapse all

Trigger connection, returned as a trigger object, whose type and properties depend on the kind of trigger. For example:

DigitalTrigger with properties:

         Source: 'External'
    Destination: 'Dev4/PFI1'
           Type: StartTrigger
      Condition: 'RisingEdge'

Trigger index, returned as a numeric value. With this index, you can access the array of the DataAcquisition DigitalTriggers property.

Version History

Introduced in R2020a