TriggerSource Property

Returns or sets the trigger source.

Syntax

Variant = object.TriggerSource()

object.TriggerSource = vNewValue

The TriggerSource property syntax has these parts:

Part Description

object Required. A valid Mathcad Data Acquisition Control object.

vNewValue Required. Variant (Long). Set to 0 for PFI0 or 1 for the analog input channel.

Remarks

The TriggerSource property is used to specify the source of the analog trigger. Digital triggers always use the PFI0 pin for the trigger input. If the TriggerType is analog then you can specify that either PFI0 pin or the analog input channel be the source of the trigger. Analog triggers also require that the TriggerLevel and TriggerEdge properties be specified.

If the analog input channel is the source of the trigger and there are multiple channels in the channel string, the first channel in the channels collection is the source of the trigger.

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.

Example

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