WaitForTrigger Property |
Returns or sets a variable that tells the control whether or not to wait for a trigger before starting waveform acquisition.
Variant = object.WaitForTrigger()
object.WaitForTrigger = vNewValue
The WaitForTrigger property syntax has these parts:
object Required. A valid Mathcad Data Acquisition Control object.
vNewValue Required. Variant (Integer). Set to 1 to wait for a trigger or 0 for not to wait.
The WaitForTrigger property, as its name implies, tells the control whether or not to wait for a trigger before starting waveform acquisition. You must specify the trigger properties using the TriggerType, TriggerEdge, TriggerSource, and TriggerLevel properties as appropriate. The default trigger is a digital trigger at the PFI0 pin.
If an invalid value, such as other than 0 or 1 or non-numeric, is specified for the property it will default back to 0.
Sub GetWaveformOnTrigger()
Dim McadDAQ As AnalogIO
Dim lTemp as Long
'the next statement assumes there is a Mathcad Data Acquisition control called
' AnalogIO1 on Form1 of a VisualBasic project
Set McadDAQ = Form1.AnalogIO1
'set the channel string to acquire from channel 1
McadDAQ.ChannelString = "1"
'set the IOFunction to input
McadDAQ.IOFunction = 0&
'set the IOType to waveform
McadDAQ.IOType = 1&
'set the number of samples to acquire for all channels
McadDAQ.NumSamples = 1000%
'set the sample rate in samples per second
McadDAQ.Rate = 10000%
'set trigger related information
McadDAQ.WaitForTrigger = 1%
'Set up for low-to-high analog trigger of 2.5 Volts at the PFI0 pin
McadDAQ.TriggerType = 1%
McadDAQ.TriggerSource = 0&
McadDAQ.TriggerEdge = 0&
McadDAQ.TriggerLevel = 2.5#
'acquire the data
McadDAQ.Acquire
'See if the right number of samples was acquired, zero base assumed
On Error Resume Next
lTemp = UBound(McadDAQ.Channels("1").Data) + 1
If Err.Number = 0 Then
MsgBox CStr(lTemp) & " samples were acquired"
Else
MsgBox "Acquisition Error"
End If
End Sub