niDCPower_InitializeWithIndependentChannels
- Updated2025-10-06
- 3 minute(s) read
Creates a new NI-DCPower session to the specified instrument(s) and channel(s) and returns a session handle to be used in all subsequent NI-DCPower function calls.
Syntax
ViStatus _VI_FUNC niDCPower_InitializeWithIndependentChannels(ViRsrc resourceName, ViBoolean reset, ViConstString optionString, ViSession *vi)
Remarks
After calling this function, the specified channel or channels will be in the Uncommitted state.
With this function and channel-based NI-DCPower functions and attributes, you can use any channels in the session independently. For example, you can initiate a subset of channels in the session with niDCPower_InitiateWithChannels, and the other channels in the session remain in the Uncommitted state.
Details
Details of Independent Channel Operation
When you initialize with independent channels, each channel steps through the NI-DCPower programming state model independently of all other channels, and you can specify a subset of channels for most operations.
You can make concurrent calls to a session from multiple threads, but the session executes the calls one at a time. If you specify multiple channels for a function or attribute, the session may perform the operation on multiple channels in parallel, though this is not guaranteed, and some operations may execute sequentially.
Related Topics:
Parameters
| Name | Direction | Type | Description |
|---|---|---|---|
| resourceName | [in] | ViRsrc | Specifies the NI-DCPower resources to use in the session. NI-DCPower resources can be names of the instrument(s) assigned by Measurement & Automation Explorer (MAX) and the channel(s) to initialize. Specify the instrument(s) and channel(s) using the form PXI1Slot3/0,PXI1Slot3/2-3,PXI1Slot4/2-3 or PXI1Slot3/0,PXI1Slot3/2:3,PXI1Slot4/2:3, where PXI1Slot3 and PXI1Slot4 are instrument resource names and 0, 2, and 3 are channels. If you pass "" for this control, all channels of the instrument(s) are included in the session. |
| reset | [in] | ViBoolean | Specifies whether to reset channel(s) during the initialization procedure. The default is VI_FALSE. To place channel(s) in a known startup state when creating a new session, set reset to VI_TRUE. This action is equivalent to using the niDCPower_ResetWithChannels function immediately after initializing the session. To open a session and leave the channel(s) in an existing configuration without passing through a transitional output state, set reset to VI_FALSE. Next, configure the channel(s) as in the previous session, change the desired settings, and then call the niDCPower_InitiateWithChannels function to write both settings. |
| optionString | [in] | ViConstString | Specifies the initial value of certain attributes for the session. The syntax for optionString is a list of attributes with an assigned value where 1 is VI_TRUE and 0 is VI_FALSE. For example: Simulate=0, DriverSetup=Model:<model number>; BoardType:<bus connector> To simulate a multi-instrument session, set Simulate to 1 and list multiple instruments for DriverSetup. For example: Simulate=1, DriverSetup=ResourceName:<instrument name>; Model:<model number>; BoardType:<bus connector> & ResourceName:<resource name>; Model:<model number>; BoardType:<bus connector> You do not have to specify a value for all the attributes. If you do not specify a value for an attribute, the default value is used. For more information about simulating a device, refer to Simulating an Instrument. |
| vi | [out] | ViSession * | Returns a session handle that you use to identify the session in all subsequent NI-DCPower function calls. |
Returns
Reports the status of this operation. To obtain a text description of the status code, call niDCPower_error_message. To obtain additional information concerning the error condition, call niDCPower_GetError. The general meaning of the status code is as follows:
Value | Meaning |
|---|---|
0 | Success |
Positive Values | Warnings |
Negative Values | Errors |