VeriStand .NET API Reference

Part 2: Adding Analog Input and Output Channels to a DAQ Device

In this section, the example code modifies the analog inputs and outputs of a DAQ device:

  1. Adding an Analog Input Channel to a DAQ Device
  2. Adding an Analog Output Channel to a DAQ Device
  3. Adding Channel Mappings for DAQ Analog Inputs and Outputs

2a. Adding an Analog Input Channel to a DAQ Device


Obtain the reference to the existing Analog Input section under the DAQ device in the system definition using the GetAnalogInputSection method.


Remove the existing Analog Input section from the system definition file using the RemoveNode property. Removing any existing analog input channels prevents conflicts between existing channels and channels you add.


Create a new Analog Input section and add it to the DAQ device using the CreateAnalogInputs method.


Add a new analog input channel by initializing a new instance of the DAQAnalogInput class.


Add the new analog input channel to the Analog Input section using the AddAnalogInput method.


Create an alias and link it to the new channel by:
  1. Obtaining the reference to the Aliases section using the Root dottable property and GetAliases method.
  2. Creating a new alias and adding it to the Aliases section using the AddNewaliasByReference method.

Related Links

DAQAnalogInput Constructor

2b. Adding an Analog Output Channel to a DAQ Device


Obtain the reference to the existing Analog Output section under the DAQ device in the system definition using the GetAnalogInputSection method.


Remove the existing Analog Output section from the system definition using the RemoveNode method. Removing any existing analog output channels prevents conflicts between existing channels and channels you add.


Create a new Analog Output section and add it to the DAQ device using the CreateAnalogOutputs method.


Create a new analog output channel by initializing a new instance of the DAQAnalogOutput class.


Add the new analog output channel to the Analog Output section using the AddAnalogOutput method.


Create an alias and link it to the new channel by:
  1. Obtaining the reference to the Aliases section using the Root dottable property and GetAliases method.
  2. Creating a new alias and adding it to the Aliases section using the AddNewaliasByReference method.

Related Links

DAQAnalogOutput Constructor

2c. Adding Channel Mappings for DAQ Analog Inputs and Outputs


Get the node path for the AO0 channel.


Get the node path for the AI0 channel.


Convert the node paths from strings to arrays using Build Array functions.
Note  Note that the parameters of the AddChannelMappings function in the next step require arrays. This allows you to create multiple mappings simultaneously. For this example, you only need to create one mapping, so each array will only contain one element.


Map AI0 to AO0. Note that the source channel, AI0, maps to the destination channel, AO0, but the destination channel stores the mapping information.

Related Links

Programming with the System Definition API in LabVIEW

Navigating the System Definition API

Previous Step
Part 1: Opening the System Definition File and Finding the First DAQ Device
Home
LabVIEW Walkthrough: Modifying a DAQ Device in a System Definition File
Next Step
Part 3: Adding Digital Input and Output Channels to a DAQ Device

Log in to get a better experience