Selects the trigger source and sets up its parameters. This trigger is used to initiate a scan using the following Universal Library functions:
C/C++
int cbSetTrigger(int BoardNum, int TrigType, unsigned short LowThreshold, unsigned short HighThreshold);
Visual Basic
Function cbSetTrigger(ByVal BoardNum&, ByVal TrigType&, ByVal LowThreshold%, ByVal HighThreshold%) As Long
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 have a software-selectable triggering source and/or options.
TrigType
Specifies the type of triggering based on the external trigger source. Set it to one of the constants in the TrigType argument values section below.
LowThreshold
Selects the low threshold used when the trigger input is analog. The range depends upon the resolution of the trigger circuitry. Must be 0 to 255 for 8-bit trigger circuits, 0 to 4,095 for 12-bit trigger circuits, and 0 to 65,535 for 16-bit trigger circuits. Refer to the Analog Trigger Notes section below.
When the trigger input is a digital pattern, LowThreshold selects the pattern value.
HighThreshold
Selects the high threshold used when the trigger input is analog. The range depends upon the resolution of the trigger circuitry. Must be 0 to 255 for 8-bit trigger circuits, 0 to 4,095 for 12-bit trigger circuits, and 0 to 65,535 for 16-bit trigger circuits. Refer to the Analog Trigger Notes section below.
When the trigger input is a digital pattern, HighThreshold selects the port mask.
Trigger source | Type | Explanation |
Analog | GATE_NEG_HYS | Scanning is enabled as long as the external analog trigger input is more positive than HighThreshold. Hysteresis is the level between LowThreshold and HighThreshold. |
GATE_POS_HYS | Scanning is enabled as long as the external analog trigger input is more negative than LowThreshold. Hysteresis is the level between LowThreshold and HighThreshold. | |
GATE_ABOVE | Scanning is enabled as long as the external analog trigger input is more positive than HighThreshold. | |
GATE_BELOW | Scanning is enabled as long as the external analog trigger input is more negative than LowThreshold. | |
GATE_IN_WINDOW | Scanning is enabled as long as the external analog trigger is inside the region defined by LowThreshold and HighThreshold. | |
GATE_OUT_WINDOW | Scanning is enabled as long as the external analog trigger is outside the region defined by LowThreshold and HighThreshold. | |
TRIG_ABOVE | Scanning begins when the external analog trigger input transitions from below HighThreshold to above. Once conversions are enabled, the external trigger is ignored. | |
TRIG_BELOW | Scanning begins when the external analog trigger input transitions from above LowThreshold to below. Once conversions are enabled, the external trigger is ignored. | |
TRIG_RISING | Scanning begins when the external analog trigger input transitions from below LowThreshold to above HighThreshold. Once conversions are enabled, the external trigger is ignored. | |
TRIG_FALLING | Scanning begins when the external analog trigger input transitions from above HighThreshold to below LowThreshold. Once conversions are enabled, the external trigger is ignored. | |
Analog Trigger Notes
| ||
Digital | GATE_HIGH | Scanning is enabled as long as the external digital trigger input is 5V (logic HIGH or '1'). |
GATE_LOW | Scanning is enabled as long as the external digital trigger input is 0V (logic LOW or '0'). | |
TRIG_HIGH | Scanning begins when the external digital trigger is 5V (logic HIGH or '1'). Once conversions are enabled, the external trigger is ignored. | |
TRIG_LOW | Scanning begins when the external digital trigger is 0V (logic LOW or '0'). Once conversions are enabled, the external trigger is ignored. | |
TRIG_PATTERN_EQ | Scanning begins when the digital port value AND bitwise mask are equal to the pattern value AND bitwise mask. Once conversions are enabled, the external trigger is ignored. | |
TRIG_PATTERN_NE | Scanning begins when the digital port value AND bitwise mask are not equal to the pattern value AND bitwise mask. Once conversions are enabled, the external trigger is ignored. | |
TRIG_PATTERN_ABOVE | Scanning begins when the digital port value AND bitwise mask are greater than the pattern value AND bitwise mask. Once conversions are enabled, the external trigger is ignored. | |
TRIG_PATTERN_BELOW | Scanning begins when the digital port value AND bitwise mask are less than the pattern value AND bitwise mask. Once conversions are enabled, the external trigger is ignored. | |
TRIG_POS_EDGE | Scanning begins when the external digital trigger transitions from 0V to 5V (logic LOW to HIGH). Once conversions are enabled, the external trigger is ignored. | |
TRIG_NEG_EDGE | Scanning begins when the external digital trigger transitions from 5V to 0V (logic HIGH to LOW). Once conversions are enabled, the external trigger is ignored. | |
Digtal Trigger Notes
|
To calculate the threshold, do the following:
Abs (–FS – threshold in volts) ÷ (LSB) = threshold in counts
Calculate the LSB: LSB = 20 ÷ 28 = 20 ÷ 256 = 0.078125
Calculate the threshold: Abs(–10 – (–5)) ÷ 0.078125 = 5 ÷ 0.078125 = 64 (round this result if it is not an integer). A count of 64 translates to a voltage threshold of –5.0 V.
Calculate the LSB: LSB = 20 ÷ 212 = 20 ÷ 4096 = 0.00488
Calculate the threshold: Abs(–10 – 1) ÷ 0.00488 = 11 ÷ 0.00488 = 2254 (rounded from 2254.1). A count of 2254 translates to a voltage threshold of 0.99952 V.