NI-FGEN C Function Reference

niFgen_CreateFreqList

  • Updated2023-02-21
  • 3 minute(s) read

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 two arrays should have the same number of elements, and this value must also be the size of the frequencyListLength. 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 outputMode parameter to NIFGEN_VAL_OUTPUT_FREQ_LIST before calling this function.

A frequency list consists of a list of frequencies and durations. 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.

Parameters

Input
Name Type Description
vi ViSession Identifies your instrument session. vi is obtained from the niFgen_init, niFgen_InitWithOptions, or niFgen_InitializeWithChannels 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 Specifies that the signal generator produces a sinusoid waveform.
NIFGEN_VAL_WFM_SQUARE Specifies that the signal generator produces a square waveform.
NIFGEN_VAL_WFM_TRIANGLE Specifies that the signal generator produces a triangle waveform.
NIFGEN_VAL_WFM_RAMP_UP Specifies that the signal generator produces a positive ramp waveform.
NIFGEN_VAL_WFM_RAMP_DOWN Specifies that the signal generator produces a negative ramp waveform.
NIFGEN_VAL_WFM_DC Specifies that the signal generator produces a constant voltage.
NIFGEN_VAL_WFM_NOISE Specifies that the signal generator produces white noise.
NIFGEN_VAL_WFM_USER Specifies that the signal generator produces a 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 function.

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

Log in to get a better experience