# ATrig()

Waits for a specified analog input channel to go above or below a specified value. ATrig() continuously reads the specified channel and compares its value to trigValue. Depending on whether trigType is set to TrigAbove or TrigBelow, it waits for the first A/D sample that is above or below trigValue. The first sample that meets the trigger criteria is returned to dataValue.

Member of the MccBoard class.

## Function Prototype

VB .NET

Public Function ATrig(ByVal chan As Integer, ByVal trigType As MccDaq.TriggerType, ByVal trigValue As Short, ByVal range As MccDaq.Range, ByRef dataValue As Short) As MccDaq.ErrorInfo

Public Function ATrig(ByVal chan As Integer, ByVal trigType As MccDaq.TriggerType, ByVal trigValue As System.UInt16, ByVal range As MccDaq.Range, ByRef dataValue As System.UInt16) As MccDaq.ErrorInfo

C# .NET

public MccDaq.ErrorInfo ATrig(int chan, MccDaq.TriggerType trigType, short trigValue, MccDaq.Range range, out short dataValue)

public MccDaq.ErrorInfo ATrig(int chan, MccDaq.TriggerType trigType, ushort trigValue, MccDaq.Range range, out ushort dataValue)

## Parameters

chan

A/D channel number. The maximum allowable channel depends on which type of A/D board is being used. When a board has both single ended and differential inputs, the maximum allowable channel number also depends on how the board is configured (such as 8 channels for DIFF inputs, and 16 channels for SE inputs).

trigType

MccDaq.TriggerType.TrigAbove or MccDaq.TriggerType.TrigBelow. Specifies whether to wait for the analog input to be above or below the specified trigger value.

trigValue

The threshold value that all A/D values are compared to. Must be in the range 0 to 4,095 for 12-bit A/D boards, or 0 to 65,535 for 16-bit A/D boards. Refer to your BASIC manual for information on signed BASIC integer data types.

range

Gain code. If the selected A/D board does not have a programmable gain feature, this parameter is ignored. Otherwise, set to any range that is supported by the selected A/D board. Refer to board specific information for a list of the supported A/D ranges of each board.

dataValue

Returns the value of the first A/D sample to meet the trigger criteria.

## Returns

- An ErrorInfo object that indicates the status of the operation.
- dataValue – value of the first A/D sample to match the trigger criteria.

## Notes

- Pressing <Ctrl-C> will not terminate the wait for an analog trigger that meets the specified condition. There are only two ways to terminate this call: satisfy the trigger condition, or to reset the computer.

## Caution!

Use caution when using this method in Windows programs. All active windows will lock on the screen until the trigger condition is satisfied. All keyboard and mouse activity will also lock until the trigger condition is satisfied.