![background image](http://html1.mh-extra.com/html/national-instruments/scxi-1521/scxi-1521_user-manual_3580183046.webp)
Chapter 5
Using the SCXI-1521/B
©
National Instruments Corporation
5-11
property of the channel programmatically, use the
DAQmxSetChanAttribute
function.
Note
Refer to
NI LabWindows/CVI Help
for more information about creating NI-DAQmx
tasks in LabWindows/CVI and NI-DAQmx property information.
Measurement Studio (Visual Basic, .NET, and C#)
When creating a strain task in Visual Basic .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 strain channel on the SCXI-1521/B. You can use
the same functions for Visual Basic .NET and C#.
Create a new task with the channel object. In this example, an analog input
channel object is used since reading the voltage from a Wheatstone bridge
configuration is an analog input operation. The following text is a function
prototype example:
void AIChannelCollection.CreateStrainGageChannel(
System.String physicalChannelName,
System.String nameToAssignChannel,
System.Double minVal,
System.Double maxVal,
AIStrainGageConfiguration
strainGageConfiguration,
AIExcitationSource excitationSource,
System.Double excitationValue,
System.Double gageFactor,
System.Double initialBridgeVoltage,
System.Double normalGageResist,
System.Double poissonRatio,
System.Double leadWireResist,
AIStrainUnits units);
To actually create and configure the channel, modify the following example
code or the code from one of the shipping examples as needed to suit your
application:
Task myTask = new
NationalInstruments.DAQmx.Task(“myTaskName”);
MyTask.CreateStrainGageChannel (
“SC1Mod1/ai0”, // System.String
physicalChannelName
“strain0”, // System.String nameToAssignChannel
-0.001, // System.Double minVal