Chapter 5
Using the SCXI-1503
5-12
ni.com
Note
Refer to the
NI LabWindows/CVI Help
for more information on creating NI-DAQmx
tasks in LabWindows/CVI and NI-DAQmx property information.
Measurement Studio (Visual Basic 6, .NET, and C#)
When creating an voltage measurement task in Visual Basic 6, .NET and
C#, follow the general programming flow in Figure 5-1. You can then use
the appropriate function calls to modify the task. This example creates a
new task and configures an NI-DAQmx voltage measurement channel on
the SCXI-1503. You can use the same functions for Visual Basic 6, .NET
and C#.
The following text is a function prototype example:
void AIChannelCollection.CreateVoltageChannel(
System.String physicalChannelName,
System.String nameToAssignChannel,
System.Double minVal,
System.Double maxVal);
To actually create and configure the channel, you would enter something
resembling the following example code:
Task myTask = new
NationalInstruments.DAQmx.Task(“myTaskName”);
MyTask.DAQmxCreateAIVoltageChan (
“SC1Mod1/ai0”, // System.String physicalChannelName
“Voltage0”, // System.String nameToAssignChannel
-10.0, // System.Double minVal
10.0); // System.Double maxVal
// setting attributes after the channel is created
AIChannel myChannel = myTask.AIChannels[“Voltage0”];
myChannel.AutoZeroMode = kAutoZeroTypeOnce;
Modify the example code above or the code from one of the shipping
examples as needed to suit your application.
Note
You can create and configure the voltage measurement task in MAX and
load it into your application with the function call
NationalInstruments.DAQmx.DaqSystem.Local.LoadTask
.
Refer to the
NI Measurement Studio Help
for more information on creating NI-DAQmx
tasks in LabWindows/CVI and NI-DAQmx property information.