NI FGEN Setup Functions - ni/grpc-device GitHub Wiki
ViStatus niFgen_init (ViRsrc resourceName, ViBoolean idQuery, ViBoolean resetDevice, ViSession* vi);
Performs the following initialization actions:
- Creates a new IVI instrument driver session.
- Opens a session to the specified device using the interface and address that you specify for the resourceName parameter.
- If the IDQuery parameter is set to VI_TRUE, this function queries the device ID and checks that the ID is valid for NI-FGEN.
- If the resetDevice parameter is set to VI_TRUE, this function resets the device to a known state.
- Sends initialization commands to set the device to the state necessary for the operation of NI-FGEN.
- Returns a session handle that you can use to identify the device in all subsequent NI-FGEN function calls.
Input | ||
---|---|---|
Name | Type | Description |
resourceName | ViRsrc | Specifies the resource name of the device to initialize.
For NI-DAQmx devices, the syntax is just the device name specified in MAX, as shown in Example 1. Typical default names for NI-DAQmx devices in MAX are Dev1 or PXI1Slot1. You can rename an NI-DAQmx device by right-clicking on the name in MAX and entering a new name. An alternate syntax for NI-DAQmx devices consists of DAQ::NI-DAQmx device name, as shown in Example 2. This naming convention allows for the use of an NI-DAQmx device in an application that was originally designed for a Traditional NI-DAQ device. For example, if the application expects DAQ::1, you can rename the NI-DAQmx device to 1 in MAX and pass in DAQ::1 for the resource name, as shown in Example 3. If you use the DAQ::n syntax and an NI-DAQmx device name already exists with that same name, the NI-DAQmx device is matched first. You can also pass in the name of an IVI logical name or an IVI virtual name configured with the IVI Configuration utility, as shown in Example 4. A logical name identifies a particular virtual instrument. A virtual name identifies a specific device and specifies the initial settings for the session. Caution: Traditional NI-DAQ and NI-DAQmx device names are not case-sensitive. However, all IVI names, such as logical names, are case-sensitive. If you use logical names, driver session names, or virtual names in your program, you must ensure that the name you use matches the name in the IVI Configuration Store file exactly, without any variations in the case of the characters. |
Example # | Device Type | Syntax | Variable |
---|---|---|---|
1 | NI-DAQmx device | myDAQmxDevice | (myDAQmxDevice = device name) |
2 | NI-DAQmx device | DAQ::myDAQmxDevice | (myDAQmxDevice = device name) |
3 | NI-DAQmx device | DAQ::2 | (2 = device name) |
4 | IVI logical name or IVI virtual name | myLogicalName | (myLogicalName = name) |
Name | Type | Description |
---|---|---|
idQuery | ViBoolean |
Specifies whether you want NI-FGEN to perform an ID query. When you set this parameter to VI_TRUE, NI-FGEN verifies that the device that you initialize is supported. Circumstances can arise where sending an ID query to the device is undesirable. When you set this parameter to VI_FALSE, the function initializes the device without performing an ID query. Default Value: VI_TRUEDefined Values |
VI_TRUE | Perform ID query |
---|---|
VI_FALSE | Skip ID query |
Name | Type | Description |
---|---|---|
resetDevice | ViBoolean |
Specifies whether you want to reset the device during the initialization procedure. VI_TRUE specifies that the device is reset and performs the same function as the niFgen_reset function. Default Value: VI_TRUE Defined Values |
VI_TRUE | Reset device |
---|---|
VI_FALSE | Do not reset device |
Output | ||
---|---|---|
Name | Type | Description |
vi | ViSession* | Returns a session handle that you can use to identify the device in all subsequent NI-FGEN function calls. |
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 |
ViStatus niFgen_InitializeWithChannels (ViRsrc resourceName, ViConstString channelName, ViBoolean resetDevice, ViConstString optionString, ViSession *vi);
Creates and returns a new NI-FGEN session to the specified channel of a waveform generator that is used in all subsequent NI-FGEN function calls.
Input | ||
---|---|---|
Name | Type | Description |
resourceName | ViRsrc | Specifies the resource name of the device to initialize.
For NI-DAQmx devices, the syntax is just the device name specified in MAX, as shown in Example 1. Typical default names for NI-DAQmx devices in MAX are Dev1 or PXI1Slot1. You can rename an NI-DAQmx device by right-clicking on the name in MAX and entering a new name. An alternate syntax for NI-DAQmx devices consists of DAQ::NI-DAQmx device name, as shown in Example 2. This naming convention allows for the use of an NI-DAQmx device in an application that was originally designed for a Traditional NI-DAQ device. For example, if the application expects DAQ::1, you can rename the NI-DAQmx device to 1 in MAX and pass in DAQ::1 for the resource name, as shown in Example 3. If you use the DAQ::n syntax and an NI-DAQmx device name already exists with that same name, the NI-DAQmx device is matched first. You can also pass in the name of an IVI logical name or an IVI virtual name configured with the IVI Configuration utility, as shown in Example 4. A logical name identifies a particular virtual instrument. A virtual name identifies a specific device and specifies the initial settings for the session. Caution: Traditional NI-DAQ and NI-DAQmx device names are not case-sensitive. However, all IVI names, such as logical names, are case-sensitive. If you use logical names, driver session names, or virtual names in your program, you must ensure that the name you use matches the name in the IVI Configuration Store file exactly, without any variations in the case of the characters. |
Example # | Device Type | Syntax | Variable |
---|---|---|---|
1 | NI-DAQmx device | myDAQmxDevice | (myDAQmxDevice = device name) |
2 | NI-DAQmx device | DAQ::myDAQmxDevice | (myDAQmxDevice = device name) |
3 | NI-DAQmx device | DAQ::2 | (2 = device name) |
4 | IVI logical name or IVI virtual name | myLogicalName | (myLogicalName = name) |
Name | Type | Description |
---|---|---|
channelName | ViConstString |
Specifies the channel that this VI uses. Default Value: "0" |
resetDevice | ViBoolean |
Specifies whether you want to reset the device during the initialization procedure. VI_TRUE specifies that the device is reset and performs the same function as the niFgen_reset function. Default Value: VI_FALSE Defined Values |
VI_TRUE | Reset device |
---|---|
VI_FALSE | Do not reset device |
Name | Type | Description |
---|---|---|
optionString | ViConstString |
Sets the initial value of certain session attributes. The syntax for optionString is <attributeName> = <value> where attributeName is the name of the attribute and value is the value to which the attribute is set To set multiple attributes, separate them with a comma. If you pass NULL or an empty string for this parameter, the session uses the default values for these attributes. You can override the default values by assigning a value explicitly in a string that you pass for this parameter. You do not have to specify all of the attributes and may leave any of them out. However, if you do not specify one of the attributes, its default value is used. If simulation is enabled (Simulate=1), you may specify the device that you want to simulate. To specify a device, enter the following syntax in optionString. DriverSetup=Model:<driver model number>;Channels:<channel names>;BoardType:<module type>;MemorySize:<size of onboard memory in bytes> Default Values: "Simulate=0,RangeCheck=1,QueryInstrStatus=1,Cache=1" Syntax Examples |
Device | optionString Syntax |
---|---|
NI PXI-5404 | DriverSetup=Model:5404;BoardType:PXI |
NI PCI-5411 | DriverSetup=Model:5411;BoardType:PCI;MemorySize:8000000 |
NI PXIe-5450 | DriverSetup=Model:5450;Channels:0-1;BoardType:PXIe;MemorySize:8000000 |
Attributes and Defined Values
Attribute Name | Attribute | Values |
---|---|---|
RangeCheck | NIFGEN_ATTR_RANGE_CHECK | VI_TRUE, VI_FALSE |
QueryInstrStatus | NIFGEN_ATTR_QUERY_INSTRUMENT_STATUS | VI_TRUE, VI_FALSE |
Cache | NIFGEN_ATTR_CACHE | VI_TRUE, VI_FALSE |
Simulate | NIFGEN_ATTR_SIMULATE | VI_TRUE, VI_FALSE |
Output | ||
---|---|---|
Name | Type | Description |
vi | ViSession | Returns a session handle that you can use to identify the device in all subsequent NI-FGEN function calls. |
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 |
ViStatus niFgen_InitWithOptions (ViRsrc resourceName, ViBoolean idQuery, ViBoolean resetDevice, ViString optionString, ViSession *vi);
Performs the following initialization actions:
- Creates a new IVI instrument session and optionally sets the initial state of the following session attributes: NIFGEN_ATTRIBUTE_RANGE_CHECK, NIFGEN_ATTRIBUTE_QUERY_INSTRUMENT_STATUS, NIFGEN_ATTRIBUTE_CACHE, NIFGEN_ATTRIBUTE_SIMULATE, and NIFGEN_ATTRIBUTE_RECORD_COERCIONS.
- Opens a session to the specified device using the interface and address that you specify for resourceName.
- If IDQuery is set to VI_TRUE, this function queries the device ID and checks that it is valid for NI-FGEN.
- If resetDevice is set to VI_TRUE, this function resets the device to a known state.
- Sends initialization commands to set the instrument to the state necessary for NI-FGEN operation.
- Returns a session handle that you can use to identify the device in all subsequent NI-FGEN function calls.
Input | ||
---|---|---|
Name | Type | Description |
resourceName | ViRsrc | Specifies the resource name of the device to initialize.
For NI-DAQmx devices, the syntax is just the device name specified in MAX, as shown in Example 1. Typical default names for NI-DAQmx devices in MAX are Dev1 or PXI1Slot1. You can rename an NI-DAQmx device by right-clicking on the name in MAX and entering a new name. An alternate syntax for NI-DAQmx devices consists of DAQ::NI-DAQmx device name, as shown in Example 2. This naming convention allows for the use of an NI-DAQmx device in an application that was originally designed for a Traditional NI-DAQ device. For example, if the application expects DAQ::1, you can rename the NI-DAQmx device to 1 in MAX and pass in DAQ::1 for the resource name, as shown in Example 3. If you use the DAQ::n syntax and an NI-DAQmx device name already exists with that same name, the NI-DAQmx device is matched first. You can also pass in the name of an IVI logical name or an IVI virtual name configured with the IVI Configuration utility, as shown in Example 4. A logical name identifies a particular virtual instrument. A virtual name identifies a specific device and specifies the initial settings for the session. Caution: Traditional NI-DAQ and NI-DAQmx device names are not case-sensitive. However, all IVI names, such as logical names, are case-sensitive. If you use logical names, driver session names, or virtual names in your program, you must ensure that the name you use matches the name in the IVI Configuration Store file exactly, without any variations in the case of the characters. |
Example # | Device Type | Syntax | Variable |
---|---|---|---|
1 | NI-DAQmx device | myDAQmxDevice | (myDAQmxDevice = device name) |
2 | NI-DAQmx device | DAQ::myDAQmxDevice | (myDAQmxDevice = device name) |
3 | NI-DAQmx device | DAQ::2 | (2 = device name) |
4 | IVI logical name or IVI virtual name | myLogicalName | (myLogicalName = name) |
Name | Type | Description |
---|---|---|
idQuery | ViBoolean |
Specifies whether you want NI-FGEN to perform an ID query. When you set this parameter to VI_TRUE, NI-FGEN verifies that the device that you initialize is a type that it supports. Circumstances can arise where sending an ID query to the device is undesirable. When you set this parameter to VI_FALSE, the function initializes the device without performing an ID query. Default Value: VI_TRUE Defined Values |
VI_TRUE | Perform ID query |
---|---|
VI_FALSE | Skip ID query |
Name | Type | Description |
---|---|---|
resetDevice | ViBoolean |
Specifies whether you want to reset the device during the initialization procedure. VI_TRUE specifies that the device is reset and performs the same function as the niFgen_reset function. Default Value: VI_TRUE Defined Values |
VI_TRUE | Reset device |
---|---|
VI_FALSE | Do not reset device |
Name | Type | Description |
---|---|---|
optionString | ViString |
Sets the initial value of certain session attributes. The syntax for optionString is <attributeName> = <value> where attributeName is the name of the attribute and value is the value to which the attribute is set To set multiple attributes, separate them with a comma. If you pass NULL or an empty string for this parameter, the session uses the default values for these attributes. You can override the default values by assigning a value explicitly in a string that you pass for this parameter. You do not have to specify all of the attributes and may leave any of them out. However, if you do not specify one of the attributes, its default value is used. If simulation is enabled (Simulate=1), you may specify the device that you want to simulate. To specify a device, enter the following syntax in optionString. DriverSetup=Model:<driver model number>;Channels:<channel names>;BoardType:<module type>;MemorySize:<size of onboard memory in bytes> Default Values: "Simulate=0,RangeCheck=1,QueryInstrStatus=1,Cache=1" Syntax Examples |
Device | optionString Syntax |
---|---|
NI PXI-5404 | DriverSetup=Model:5404;BoardType:PXI |
NI PCI-5411 | DriverSetup=Model:5411;BoardType:PCI;MemorySize:8000000 |
NI PXIe-5450 | DriverSetup=Model:5450;Channels:0-1;BoardType:PXIe;MemorySize:8000000 |
Attributes and Defined Values
Attribute Name | Attribute | Values |
---|---|---|
RangeCheck | NIFGEN_ATTR_RANGE_CHECK | VI_TRUE, VI_FALSE |
QueryInstrStatus | NIFGEN_ATTR_QUERY_INSTRUMENT_STATUS | VI_TRUE, VI_FALSE |
Cache | NIFGEN_ATTR_CACHE | VI_TRUE, VI_FALSE |
Simulate | NIFGEN_ATTR_SIMULATE | VI_TRUE, VI_FALSE |
Output | ||
---|---|---|
Name | Type | Description |
vi | ViSession | Returns a session handle that you can use to identify the device in all subsequent NI-FGEN function calls. |
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 |
ViStatus niFgen_close (ViSession vi);
Performs the following operations:
- Closes the instrument I/O session.
- Destroys the NI-FGEN session and all of its attributes.
- Deallocates any memory resources NI-FGEN uses.
Note: After calling niFgen_close, you cannot use NI-FGEN again until you call the niFgen_init or niFgen_InitWithOptions functions.
Not all signal routes established by calling the niFgen_ExportSignal and niFgen_RouteSignalOut functions are released when the NI-FGEN session is closed. The following table shows what happens to a signal route on your device when you call the niFgen_close function.
Routes To | NI 5401/5411/5431 | Other Devices |
---|---|---|
Front Panel | Remain connected | Remain connected |
RTSI/PXI Backplane | Remain connected | Disconnected |
Input | ||
---|---|---|
Name | Type | Description |
vi | ViSession | Identifies your instrument session. vi is obtained from theniFgen_init, niFgen_InitWithOptions, or niFgen_InitializeWithChannels functions and identifies a particular instrument session. |
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 |