addTriggerConnection

Add trigger connection

Syntax

addTriggerConnection(s,source,destination,type)
tc = addTriggerConnection(s,source,destination,type)
[tc,idx] = addTriggerConnection(s,source,destination,type)

Description

example

addTriggerConnection(s,source,destination,type) establishes a trigger connection from the specified source device and terminal to the specified destination device and terminal, of the specified connection type.

Note

You cannot use triggers with audio devices.

Tip

Before adding trigger connections, create a session using daq.createSession, and add channels to the session.

example

tc = addTriggerConnection(s,source,destination,type) establishes a trigger connection from the specified source and terminal to the specified destination device and terminal, of the specified connection type and displays it in the variable tc.

example

[tc,idx] = addTriggerConnection(s,source,destination,type) establishes a trigger connection from the specified source device and terminal to the specified destination device and terminal of the specified connection type, and displays the connection in the variable tc and the connection index in idx.

Examples

collapse all

Create a session and add an analog input channel from Dev1 to the session.

s = daq.createSession('ni')
addAnalogInputChannel(s,'Dev1','ai0','Voltage');

Add a trigger connection from an external device to terminal PFI1 on Dev1 using the 'StartTrigger' connection type.

addTriggerConnection(s,'external','Dev1/PFI1','StartTrigger')

To Add trigger connection going to an external destination, create a session and add an analog input channel from Dev1 to the session.

s = daq.createSession('ni')
addAnalogInputChannel(s,'Dev1','ai0','Voltage');

Add a trigger from terminal PFI1 on Dev1 to an external device using the 'StartTrigger' connection type.

addTriggerConnection(s,'Dev1/PFI1','external','StartTrigger')

Add a trigger connection from terminal PFI1 on Dev1 to terminal PFI0 on Dev2 using the 'StartTrigger' connection type and store it in tc.

To display a trigger connection in a variable, create a session and add an analog input channel from Dev1 and Dev2 to the session.

s = daq.createSession('ni')
addAnalogInputChannel(s,'Dev1','ai0','Voltage');
addAnalogInputChannel(s,'Dev2','ai1','Voltage');

Save the trigger connection in tc.

tc = addTriggerConnection(s,'Dev1/PFI1','Dev2/PFI0','StartTrigger');

Input Arguments

collapse all

Data acquisition session, specified as a session object. Create the session object using daq.createSession. Use the data acquisition session for acquisition and generation operations. Create one session per vendor and use that vendor session to perform all data acquisition operations.

Source for the trigger connection, specified as a character vector or string. Valid values are:

  • 'external' — for a trigger based on an external event. A session with an external trigger source has a timeout determined by the ExternalTriggerTimeout property; to disable the timeout, set the ExternalTriggerTimeout value to Inf.

  • 'deviceID/terminal' — for a trigger sourced on a specific terminal on a device in your session. For example, 'Dev1/PFI1', for more information on device ID see Device. For more information on terminal see Terminals.

  • 'chassisId/terminal' — for a trigger sourced on a specific terminal on a chassis in your session, for example, 'cDAQ1/PFI1'. For more information on terminal see Terminals.

You can have only one trigger source in a session.

Destination for the trigger connection, specified as a character vector or string. Valid values are:

  • 'external' — for a trigger source connected to an external device.

  • 'deviceID/terminal' — for a trigger source connected to another device in your session, for example, 'Dev1/PFI1'. For more information on device ID see Device. For more information on terminal see Terminals.

  • 'chassisId/terminal' — for a trigger source connected to a chassis in your session, for example, 'cDAQ1/PFI1'. For more information on terminal see Terminals.

You can also specify multiple destination devices as an array, for example, {'Dev1/PFI1','Dev2/PFI1'}.

The trigger connection type, specified as a character vector or string. 'StartTrigger' is the only connection type available for trigger connections at this time.

Output Arguments

collapse all

The trigger connection that you add, returned as an object of trigger connection information. The object contains the following properties.

DestinationIndicates trigger destination terminal
ExternalTriggerTimeoutSpecify maximum wait time for external trigger
IsWaitingForExternalTriggerIndicates if synchronization is waiting for an external trigger
SourceIndicates trigger source terminal
TerminalsTerminals available on device or CompactDAQ chassis
TriggerConditionSpecify condition that must be satisfied before trigger executes
TriggerTypeType of trigger executed
TriggersPerRunIndicate the number of times the trigger executes in an operation
TriggersRemainingIndicates the number of trigger to execute in an operation

Channel index returned as a numeric value. Through the index you can access the array of the session object Channels property.

Introduced in R2012a