SignalOccurrence Event

NI Vision for Visual Basic

SignalOccurrence Event

Syntax

Sub ControlName_SignalOccurrence(Signal, SignalLineNumber, UserData, StatusCode, ContextID, ContextDescription)

Applies To

CWIMAQ

Purpose

Fires when a signal occurs.

Remarks

Call EnableOccurrence to set up a signal to generate this event. The Signal parameter determines which signal assertion generates this event. This event, as well as IMAQError, returns error information. Calling DisableOccurrences disables all events you set up with EnableSignalOccurrence.

Parameters

Signal As Long

The signal that generated the event.

SignalLineNumber As Long

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

User data passed in from EnableSignalOccurrence for the corresponding signal that generated the event.

StatusCode As Long

The status code for the error.

ContextID As Long

Identifies the context of the error. The CWIMAQErrorContexts constants define the possible values for this parameter.

ContextDescription As String

A textual description of the context.

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

EnableSignalOccurrence

DisableSignalOccurrences

IMAQError