cbDaqSetTrigger()

Selects the trigger source and sets up its parameters. This trigger is used to initiate or terminate an acquisition using the cbDaqInScan() function if the EXTTRIGGER option is selected. This function only works with boards that support synchronous output.

Function Prototype

C/C++

int cbDaqSetTrigger(int BoardNum, int TrigSource, int TrigSense, int TrigChan, int ChanType, int Gain, float Level, float Variance, int TrigEvent);

Visual Basic

Function cbDaqSetTrigger(ByVal BoardNum&, ByVal TrigSource&, ByVal TrigSense&, ByVal TrigChan&, ByVal ChanType&, ByVal Gain&, ByVal Level!, ByVal Variance!, ByVal TrigEvent&) As Long

Arguments

BoardNum

The number associated with the board when it was installed with InstaCal or created with cbCreateDaqDevice(). BoardNum may be 0 to 99. The board must support synchronous input.

TrigSource

Specifies the type of triggering based on the external trigger source. Set to one of the constants specified in TrigSource argument values section below.

TrigSense

Specifies the trigger sensitivity. The trigger sensitivity normally defines the way in which a trigger event is detected based upon the characteristics of the trigger input signal. However, it often defines the way in which the trigger input signal(s) should be compared to the trigger level parameter value. Set to of the constants specified in TrigSense argument values section below.

TrigChan

Specifies the trigger channel. The trigger channel must be a configured channel in the channel array (refer to cbDaqInScan()).

ChanType

Specifies the channel type and should match the channel type setting for the trigger channel configured using the cbDaqInScan() function.

Gain

Specifies the trigger channel gain code. If the device has programmable gain, this argument should match the gain code setting when the channel is configured using the cbDaqInScan() function. The Gain parameter is ignored if TrigChan is not an analog channel.

Level

A single precision floating point value which represents, in engineering units, the level at or around which the trigger event should be detected.

This option is used for trigger types that depend on an input channel comparison to detect the start trigger or stop trigger event.

The actual level at which the trigger event is detected depends upon trigger sensing and variability. Refer to the Trigger Levels section below for more information.

Variance

A single-precision floating point value which represents, in engineering units, the amount that the trigger event can vary from the Level parameter.

While the TrigSense parameter indicates the direction of the input signal relative to the Level parameter, the Variance parameter specifies the degree to which the input signal can vary relative to the Level parameter.

TrigEvent

Specifies the trigger event type. Valid values indicate either a start trigger event (START_EVENT) or a stop trigger event (STOP_EVENT).

START_EVENT: The start trigger event defines the conditions under which post-trigger acquisition data collection should be initiated or triggered. The start trigger event can vary in complexity from starting immediately, to starting on complex channel value definitions.

STOP_EVENT: The stop trigger event signals the current data acquisition process to terminate. The stop event can be as simple as that of a scan count, or as complex as involving a channel value level condition.

Returns

TrigSource argument values

TRIG_IMMEDIATEStart trigger event only. Acquisition begins immediately upon invocation the cbDaqInScan() function. No pre-trigger data acquisition is possible with this trigger type.
TRIG_EXTTTLStart trigger event only. Acquisition begins on the selectable edge of an external TTL signal. No pre-trigger data acquisition is possible with this trigger type.
TRIG_ANALOGHWStart trigger event only. Data acquisition begins upon a selectable criteria of the input signal (above level, below level, rising edge, etc.) TrigChan must be defined as the first channel in the channel scan group. No pre-trigger data acquisition is possible with this trigger type.
TRIG_ANALOGSWPost-trigger data acquisition begins upon a selectable criteria of the input signal (above level, below level, rising edge, etc.)
TRIG_DIGPATTERNPost-trigger data acquisition beings upon receiving a specified digital pattern on the specified digital port.
TRIG_COUNTERPost-trigger data acquisition begins upon detection of specified counter criteria.
TRIG_SCANCOUNTStop trigger event only. Stops collecting post-trigger data when the specified number of post-trigger scans are completed.

TrigSense argument values

RISING_EDGETriggers when the signal goes from low to high (TTL trigger) or rises through a specified level (hardware analog, software analog, and counter).
FALLING_EDGETriggers when the signal goes from high to low (TTL trigger) or falls through a specified level (hardware analog, software analog, and counter).
ABOVE_LEVELTriggers when the signal is above a specified level (hardware analog, software analog, counter, and digital pattern).
BELOW_LEVELTriggers when the signal is below a specified level (hardware analog, software analog, counter, and digital pattern).
EQ_LEVELTriggers when the signal equals a specified level (hardware analog, software analog, counter, and digital pattern).
NE_LEVELTriggers when the signal does not equal a specified level (hardware analog, software analog, counter, and digital pattern).
HIGH_LEVELTriggers when the signal is 5V (logic HIGH or "1").
LOW_LEVELTriggers when the signal is 0V (logic LOW or "0").

Trigger levels

The actual level at which the trigger event is detected depends upon trigger sensing and variability. The various ranges of possible values for the Level parameter based on the trigger source are listed here:

Trigger start and stop criteria

The table below lists the trigger start and stop criteria based on the selected trigger type and sensitivity.

Trigger Start/Stop Source (TrigSource)Trigger Sensitivity (TrigSense)Trigger Start/Stop Criteria
TRIG_ANALOGHW
(Start trigger event only)
RISING_EDGETriggers when the signal value < (Level – Variance). Then, the signal value > Level.
FALLING_EDGETriggers when the signal value > (Level + Variance). Then, the signal value < Level.
ABOVE_LEVELTriggers when the signal value > (Level).
BELOW_LEVELTriggers when the signal value < (Level).
TRIG_ANALOGSWRISING_EDGETriggers/stops when the signal value < (Level – Variance). Then, the signal value > Level.
FALLING_EDGETriggers/stops when the signal value > (Level + Variance). Then, the signal value < Level.
ABOVE_LEVELTriggers/stops when the signal value > (Level).
BELOW_LEVELTriggers/stops when the signal value < (Level).
EQ_LEVELTriggers/stops when the (Level – Variance) < signal value < (Level + Variance).
NE_LEVELTriggers/stops when the signal value < (Level – Variance) OR when the signal value > (Level + Variance).
TRIG_DIGPATTERNABOVE_LEVELTriggers/stops when the (digital port value AND (bitwise) Variance) > (Level AND (bitwise) Variance).
BELOW_LEVELTriggers/stops when the (digital port value AND (bitwise) Variance) < (Level AND (bitwise) Variance).
EQ_LEVELTriggers/stops when the (digital port value AND (bitwise) Variance) = (Level AND (bitwise) Variance).
NE_LEVELTriggers/stops when the (digital port value AND (bitwise) Variance) != (Level AND (bitwise) Variance).
TRIG_COUNTERRISING_EDGETriggers/stops when the counter channel < (Level Level – Variance). Then, the counter channel > Level.
FALLING_EDGETriggers/stops when the counter channel > (Level + Variance). Then, the counter channel < Level.
ABOVE_LEVELTriggers/stops when the counter channel > (Level – Variance).
BELOW_LEVELTriggers/stops when the counter channel < (Level + Variance).
EQ_LEVELTriggers/stops when (Level – Variance) < counter channel < (Level + Variance).
NE_LEVELTriggers/stops when the counter channel < (Level – Variance) OR when the counter channel > (Level + Variance).