EnableSignalOccurrence Method

NI Vision for Visual Basic

EnableSignalOccurrence Method

Syntax

CWIMAQ.EnableSignalOccurrence Signal, SignalPolarity, Rearm [, SignalLineNumber] [, UserData]

Return Type

Long

This method returns 0 on success, a negative number on an error, and a positive number on a warning.

Purpose

Enables the SignalOccurrence event to generate on a signal.

Remarks

Call this method to configure the SignalOccurrence event to generate on a variety of signal sources. Set Rearm to True to generate the event on multiple occurrences. UserData passes any information needed to the event.

Parameters

Signal As CWIMAQSignalSources

The signal that generates the SignalOccurrence event when asserted.

SignalPolarity As CWIMAQSignalPolarities

The polarity of the signal.

Rearm As Boolean

Set Rearm to True to generate the event multiple times.

SignalLineNumber As Variant

[Optional] If you set Signal to cwimaqExternalLine or cwimaqRTSILine, SignalLineNumber is the line number of the signal. Otherwise, the method ignores this parameter.

UserData As Variant

[Optional] User data that is passed into SignalOccurrence for the corresponding signal that generated the event.

Example

' This example requires you to have the following controls on the form:
' 1) A button named Acquire. 
' 2) A button named Stop.
' 3) A Text box named Counter.
' 4) A CWIMAQ control named CWIMAQ1
Private Sub Stop_Click()
    CWIMAQ1.Stop
    CWIMAQ1.DisableSignalOccurrences
End Sub

Private Sub Acquire_Click()
    CWIMAQ1.EnableSignalOccurrence cwimaqBufferComplete, cwimaqActiveHigh, TRUE, 0
    CWIMAQ1.Start
End Sub

Private Sub CWIMAQ1_SignalOccurrence(ByVal Signal As Integer, ByVal SignalLineNumber As Integer, UserData As Variant, ByVal StatusCode As Long, ByVal ContextID As Long, ByVal ContextDescription As String)
    Dim i As Long
    If Signal = cwimaqBufferComplete Then
        i = Counter.Text
        i = i + 1
        Counter.Text = i
    End If
End Sub

See Also

DisableSignalOccurrences

SignalOccurrence