niFgen_CreateWaveformFromFileHWS

NI-FGEN C Function

niFgen_CreateWaveformFromFileHWS

ViStatus niFgen_CreateWaveformFromFileHWS (ViSession vi, ViConstString channelName, ViConstString filename, ViBoolean useRateFromWaveform, ViBoolean useGain&OffsetFromWaveform, ViInt32* waveformHandle);

Purpose

Takes the waveform data from the specified HWS (Hierarchical Waveform Storage) file and creates an onboard waveform for use in Arbitrary Waveform or Arbitrary Sequence output mode. The waveformHandle returned by the function can be used later for setting the active waveform, changing the data in the waveform, building sequences of waveforms, or deleting the waveform when it is no longer needed.
When the Analog Waveform Editor saves data in an HWS file, it also stores the rate, gain and offset with the data. If the useRateFromWaveform and useGain&OffsetFromWaveform inputs are set to VI_TRUE, this function also sets those properties on NI-FGEN.


Note Notes  If you choose to have this function set the gain and offset properties for you, you should not use the niFgen_ConfigureArbWaveform or niFgen_ConfigureArbSequence functions, as they also set the gain and offset, thereby overriding the values set by this function. Instead, use the NIFGEN_ATTR_ARB_WAVEFORM_HANDLE or NIFGEN_ATTR_ARB_SEQUENCE_HANDLE attributes.
HWS files may contain I16 or DBL data (depending on how it was saved). This function automatically adapts to either data type. If the file contains DBL data, it must be between -1.0 and +1.0. Check the "Scale Data to +/- 1V" option in the Analog Waveform Editor to ensure your data is between -1.0 and +1.0.

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.
channelName ViConstString Specifies the channel name for which you want to create the waveform.

Defined Value: "0"

Default Value: "0"

fileName ViConstString The full path and name of the file where the waveform data resides.

useRateFromWaveform ViBoolean If you set this parameter input to VI_TRUE and if onboard signal processing (OSP) is enabled, the 'rate' from the waveform is interpreted as the data rate, and FGEN sets the data rate attribute for you. In all other cases, it is interpreted as the sample rate, and FGEN sets the sample rate attribute for you.

Defined Values

VI_TRUEUse rate from waveform.
VI_FALSE Do not use rate from waveform.


Default Value: VI_TRUE

useGain&OffsetFromWaveform ViBoolean If this input is set to VI_TRUE, NI-FGEN retrieves the gain and offset values from the specified HWS file and applies them to the NI-FGEN driver.

Defined Values

VI_TRUEUse gain and offset from waveform.
VI_FALSE Do not use gain and offset from waveform.

Default Value: VI_TRUE

Output
Name Type Description
waveformHandle ViInt32* The handle that identifies the new waveform. This handle is used later when referring to this waveform.

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