imaqIOPulseCreate

NI-IMAQ I/O C Function

imaqIOPulseCreate

Format

rval = imaqIOPulseCreate(IMAQIO_SESSION id, 
	IMAQIOTimebase delayTimebase, unsigned long delay, 
	IMAQIOTimebase widthTimebase, unsigned long width, 
	IMAQIOSignalType triggerSignalType, unsigned long triggerSignalNumber, IMAQIOPolarity triggerSignalPolarity, 
	IMAQIOSignalType outputSignalType, unsigned long outputSignalNumber, IMAQIOPolarity outputSignalPolarity, 
	IMAQIOPulseMode pulseMode, IMAQIO_PULSE_ID* pulseID);

Purpose

Configures one of the six pulse generators for the NI-IMAQ I/O device. Refer to your hardware documentation for more information about connecting and configuring the pulse generators.

Parameters

Name Type Direction
id IMAQIO_SESSION input
delayTimebase IMAQIOTimebase input
delay unsigned long input
widthTimebase IMAQIOTimebase input
width unsigned long input
triggerSignalType IMAQIOSignalType input
triggerSignalNumber unsigned long input
triggerSignalPolarity IMAQIOPolarity input
outputSignalType IMAQIOSignalType input
outputSignalNumber unsigned long input
outputSignalPolarity IMAQIOPolarity input
pulseMode IMAQIOPulseMode input
pulseID IMAQIO_PULSE_ID* output

Parameter Discussion

id is the ID of the session to create a pulse on.

delayTimeBase is the timebase of the pulse delay. The following values are valid for this parameter:

NameConstantDescription
IMAQIO_TIMEBASE_ENCODER_TICKS 4Defines the delay or width in encoder counts
IMAQIO_TIMEBASE_MICROSECONDS 5Defines the delay or width in microseconds.

delay is the pulse delay.

widthTimeBase is the timebase of the pulse width. The following values are valid for this parameter:

NameConstantDescription
IMAQIO_TIMEBASE_MICROSECONDS 5Defines the delay or width in microseconds.

width is the width of the pulse.

triggerSignalType is the type of signal to trigger on. The following values are valid for this parameter:

NameConstantDescription
IMAQIO_SIGNAL_ISO_IN 2Use isolated inputs 5, 8, and 12 to trigger a pulse.
IMAQIO_SIGNAL_STATUS 4Signal status signals are internal timing signals, including the immediate trigger mode.
IMAQIO_SIGNAL_TTL_IN 5Use either TTL input 0 or 1 to trigger a pulse.

triggerSignalNumber is the line number of the signal to trigger on. If you set triggerSignalType to IMAQIO_SIGNAL_STATUS, use IMAQIO_STATUS_SIGNAL_NONE to cause the pulse to start immediately upon calling imaqIOPulseStart.

triggerSignalPolarity is the polarity of the trigger as defined by the following constants:

IMAQIO_POLARITY_HIGH_TRUETriggers the pulse on a rising edge.
IMAQIO_POLARITY_LOW_TRUETriggers the pulse on a falling edge.

outputSignalType is the type of signal to create a pulse on. The following values are valid for this parameter:

NameConstantDescription
IMAQIO_SIGNAL_ISO_OUT 3ISO output signals are general-purpose outputs.
IMAQIO_SIGNAL_TTL_OUT 6TTL output signals are general-purpose outputs.

outputSignalNumber is the line number of the signal to create the pulse on.

outputSignalPolarity is the polarity of the pulse output as defined by the following constants:

IMAQIO_POLARITY_HIGH_TRUEDrives the line high during the pulse assertion, which is dictated by the width.
IMAQIO_POLARITY_LOW_TRUEDrives the line low during the pulse assertion, which is dictated by the width.

pulseMode is a value that indicates if the pulse is generated once or continuously. pulseMode can be one of the following constants:

PULSE_MODE_TRAIN Pulse is generated continuously after the trigger is asserted. Choose this option to generate a continuous pulse train that is inactive for the time specified in the delay parameter and active for the time specified in the width parameter. When the pulse train is started, it continues periodically until you call imaqIOPulseStop, imaqIOPulseDispose, or imaqIOClose.

This mode is valid only if you set triggerSignalType to IMAQIO_SIGNAL_STATUS, and triggerSignalNumber is set to IMAQIO_STATUS_SIGNAL_NONE.

PULSE_MODE_SINGLEPulse is generated only one time in response to the triggering condition being satisfied. If triggerSignalType is set to IMAQIO_SIGNAL_STATUS and triggerSignalNumber is set to IMAQIO_STATUS_SIGNAL_NONE, pulse generation will start immediately after calling imaqIOPulseStart. Otherwise, the pulse will start after the respective trigger line is asserted. In either case, after the trigger condition is satisfied, the output line stays inactive for the time specified in the delay parameter and becomes active for the time specified in the width parameter.
PULSE_MODE_SINGLE_REARMPulse occurs one time on each trigger occurrence. Choose this option to generate a rearmed single-shot pulse. On every occurrence of the trigger, the output line stays inactive for the time specified in the delay parameter and becomes active for the time specified in the width parameter. When the pulse is started, output toggles for each occurrence of the trigger until you call imaqIOPulseStop, imaqIOPulseDispose, or imaqIOClose. This mode works only when the application is configured to trigger on the TTL In or ISO In lines.

pulseID is a pointer to a variable to receive the pulse ID. If the function succeeds, the variable is populated with a valid PULSE_ID that you can use in subsequent functions.

Return Value

This function returns 0 on success. On failure, this function returns an error code. For information about the error code, call imaqIOGetErrorText.