Initialize Method

NI Vision for Visual Basic

Initialize Method

Syntax

CWIMAQPulse.Initialize Delay, Width, Action, SignalPolarity, SignalSource [, SignalLineNumber]

Purpose

Configures a pulse object.

Remarks

You can use this method to set several pulse properties at once.

Parameters

Delay As Double

The interval before the pulse.

Width As Double

The interval of the pulse.

Action As CWIMAQPulseActions

The type of pulse.

SignalPolarity As CWIMAQSignalPolarities

The polarity of the signal source.

SignalSource As CWIMAQSignalSources

The source that generates the pulse.

SignalLineNumber As Variant

[Optional] The line number of the signal source if SignalSource is cwimaqExternalLine or cwimaqRTSI.

Example

Private Sub Run_Click()
    Dim pulse1 As cwimaqPulse
    Dim signal1 As CWIMAQSignal
    ' Add a signal
    Set signal1 = CWIMAQ1.Signals.Add
    
    ' Set the signal object to generate a pulse
    ' on external line 0.
    signal1.Action = cwimaqGeneratePulse
    signal1.Line = cwimaqExternal
    signal1.LineNumber = 0
    
    ' Add a pulse.
    ' Set the pulse to have a width of 1 second
    ' after the initial delay of 1 seconds.
    ' The pulse is generated immediately after
    ' RTSI 3 is asserted.
    CWIMAQ1.Pulses.Add.Initialize 1#, 1#, cwimaqSingle, _
                                  cwimaqActiveHigh, cwimaqRTSILine, 3
    
    ' Set pulse1 as the pulse that signal1 generates
    Set signal1.pulse = CWIMAQ1.Pulses(1)
End Sub