niFgen_CreateFreqList

NI-FGEN C Function

niFgen_CreateFreqList

ViStatus niFgen_CreateFreqList (ViSession vi, ViInt32 waveform, ViInt32 frequencyListLength, ViReal64[] frequencyArray, ViReal64[] durationArray, ViInt32* frequencyListHandle);

Purpose

Creates a frequency list from an array of frequencies (frequencyArray) and an array of durations (durationArray). The arrays must be the same size, and this must also be the size of the the frequencyListLength. The signal generator generates each frequency for the given amount of time and then proceeds to the next frequency. When the end of the list is reached, the signal generator starts over at the beginning of the list. The function returns a handle that identifies the frequency list (the frequencyListHandle). You can pass this handle to niFgen_ConfigureFreqList to specify what frequency list you want the signal generator to produce.

Notes  The signal generator must not be in the Generating state when you call this function.
You must call the niFgen_ConfigureOutputMode function to set the output mode to NIFGEN_VAL_OUTPUT_FREQ_LIST before calling this function.

Parameters

Input
Name Type Description
vi ViSession Identifies your instrument session. vi is obtained from the niFgen_init or the niFgen_InitWithOptions functions and identifies a particular instrument session.
waveform ViInt32 Specifies the standard waveform that you want the signal generator to produce. NI-FGEN sets the NIFGEN_ATTR_FUNC_WAVEFORM attribute to this value.

Defined Values

NIFGEN_VAL_WFM_SINE Sinusoidal waveform
NIFGEN_VAL_WFM_SQUARE Square waveform
NIFGEN_VAL_WFM_TRIANGLE Triangular waveform
NIFGEN_VAL_WFM_RAMP_UP Positive ramp waveform
NIFGEN_VAL_WFM_RAMP_DOWN Negative ramp waveform
NIFGEN_VAL_WFM_DC Constant voltage
NIFGEN_VAL_WFM_NOISE White noise
NIFGEN_VAL_WFM_USER User-defined waveform as defined with the niFgen_DefineUserStandardWaveform function

Default Value: NIFGEN_VAL_WFM_SINE

frequencyListLength ViInt32 Specifies the number of steps in the frequency list you want to create. The value must be between the minimum and maximum frequency list lengths that the signal generator allows. You can obtain the minimum and maximum frequency list lengths from the minimumFrequencyListLength and maximumFrequencyListLength parameters in the niFgen_QueryFreqListCapabilities functions.

frequency and duration must each be at least as long as this frequency list length.

Default Value: None

frequencyArray ViReal64[] Specifies the array of frequencies to form the frequency list. The array must have at least as many elements as the value you specify in frequencyListLength. Each frequencyArray element has a corresponding durationArray element that indicates how long that frequency is repeated.

Units: hertz

Default Value: None

durationArray ViReal64[] Specifies the array of durations to form the frequency list. The array must have at least as many elements as the value that you specify in frequencyListLength. Each durationArray element has a corresponding frequencyArray element and indicates how long in seconds to generate the corresponding frequency.

Units: seconds

Default Value: None

Output
Name Type Description
frequencyListHandle ViInt32* Returns the handle that identifies the new frequency list. You can pass this handle to niFgen_ConfigureFreqList to generate the arbitrary sequence.

Return Value

Name Type Description
Status ViStatus Returns the status code of this operation. The status code either indicates success or describes an error or warning condition. You can examine the status code from each call to an NI-FGEN function to determine if an error occurred. To obtain a text description of the status code, call the niFgen_error_message function. To obtain additional information about the error condition, call the niFgen_GetError function. To clear the error information from NI-FGEN, call the niFgen_ClearError function.

The general meaning of the status code is as follows:

Value Meaning
0 Success
Positive Values Warnings
Negative Values Errors