WriteWaveformPulseTrain

Requests a series of pulses be sent out a specified discrete output line, and produces a Waveform data structure containing the pulse train data.

Note:
  • This function is enabled only when the vision system is Online.
  • When transitioning between Online and Offline states, any currently executing Waveform function will be stopped immediately, and all queued waveforms will be dropped. The Waveforms will only begin when the In-Sight vision system is Online.
  • After the function is triggered to begin the Waveform, the Waveform will continue in the background until it completes its cycle.
  • Only one Waveform may be generated at a time, regardless of the number of WriteWaveformPulseTrain functions in the job, or the number of output lines dedicated to the function(s).

WriteWaveformPulseTrain Inputs

Syntax: WriteWaveformPulseTrain(Event,Output,Period,Duty Cycle,Pulse Polarity,Queuing,Idle Periods,Number of Pulses)

Parameter Description

Event

Specifies the event on which to begin the waveform. This parameter must be a reference to one of the following:

  • The Image data structure in cell A0, containing the AcquireImage function. For more information, see AcquireImage.
  • A cell containing an Event function. For more information, see Event.
  • A cell containing a Button function. For more information, see Button.
Note: When the default Event reference is deleted, the value is replaced by a checkbox. If another cell is referenced as an event, the function will conditionally run based on the referenced cell. If the checkbox is enabled, the function will always run when any inputs to the function are updated.

Output

Specifies the output line to be used. Any discrete output line may be used, e.g. high-speed, an In-Sight vision system's user-configurable LEDs or additional I/O module outputs (if connected).

Note:
  • If the selected discrete output's Type parameter is not configured to Waveform, the function will return #ERR. For more information, see Waveform Functions. The #ERR state will not be cleared until the Waveform function is executed, by either one or more cells referenced in the function's parameters executing:

    • A cell referenced in a Conditionally Enabled expression executing. For more information, see Cell State Dialog.
    • The cell containing the function being edited.
    • A job being loaded.

Period

Specifies the total amount of time (in milliseconds) from the start of one pulse to the start of the next pulse (10 to 10,000; default = 1000).

Duty Cycle

Specifies the percent of time (a percentage of the Period parameter) that the pulse spends in the active state (0 to 100%; default = 50).

Note: The actual duty cycle will be the closest possible, given the limitations of the In-Sight vision system and the I/O module used. The Duty Cycle will be less accurate if the Period parameter is set near its minimum value.
Pulse Polarity

Specifies the polarity of the pulse.

0 = High (default) When the pulse is active, the output line is forced to High. When the pulse is inactive, the output is set to Low.
1 = Low When the pulse is active, the output line is forced to Low. When the pulse is inactive, the output is set to High.
Queuing

Specifies whether or not Waveform queuing is enabled or disabled.

0 = Disabled When queuing is disabled, if an old Waveform is executing, the function will return #ERR.
1 = Enabled (default) When queuing is enabled, if an old Waveform is executing, the function will place the new Waveform on a queue to be executed later.

Idle Periods

Specifies the number of periods (0 to 10000; default = 3) that the function waits in the idle state after the Waveform has completed before beginning the next Waveform.
Number of Pulses Specifies the total number of pulses (1 to 10000; default = 10) that constitute the pulse train.

WriteWaveformPulseTrain Outputs

Returns

A Waveform data structure containing the pulse train data, or #ERR if either input parameter is invalid.

WriteWaveformPulseTrain Examples

The following figures illustrate the parameters of the WriteWaveformPulseTrainfunction. In each example, there are three (3) pulses and two (2) idle periods.

  • WriteWaveformPulseTrain Function with Pulse Polarity set to High:

  • WriteWaveformPulseTrain Function with Pulse Polarity set to Low:

Note: The actual voltage at the output varies, depending on the particular output and wiring. For outputs wired for "NPN" or "Current Sink" operations, the voltage levels will be the reverse of those in the figures above.