cbATrig()

Waits for a specified analog input channel to go above or below a specified value. cbATrig() 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.

Function Prototype

C/C++

int cbATrig(int BoardNum, int Channel, int TrigType, int TrigValue, int Range, unsigned short *DataValue)

Visual Basic

Function cbATrig(ByVal BoardNum&, ByVal Channel&, ByVal TrigType&, ByVal TrigValue%, ByVal Range&, DataValue%) 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 specified board must have an A/D.

Channel

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

TRIGABOVE or 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 argument 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

Notes

Caution!

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