Using a NI-DAQmx Task and the DAQ Assistant With Microsoft Visual Studio .NET Programming
Primary Software: Measurement Studio>>.NET Support
Primary Software Version: 1.0
Primary Software Fixed Version: N/A
Secondary Software: Measurement Studio>>Enterprise Edition (Full Development System)
Problem: It is very easy to set up a NI-DAQmx task in the Measurement & Automation Explorer (MAX) using the DAQ Assistant to configure my channels, timing, triggering, and scaling. How can I use the DAQ Assistant with my Microsoft .NET program?
Solution: You can use the DAQ Assistant to create NI-DAQmx Tasks in Visual Studio .NET with MAX.
- In Visual Studio .NET, open your project.
- Select File»Add New Item.
- In the dialog box, select Measurement Studio under Catagories and DAQmx Task under Templates.
- Click Open. You now have two options, either New Item or Copy Global Task. If you have already set up your NI-DAQmx Task in MAX, select Copy Global Task, select your task, and skip to step 6 of these instructions. If you do not already have a task, select New Item, which will invoke the DAQ Assistant.
- If you invoke the DAQ Assistant, select the type of measurement you want to perform and follow the series of menus to configure the channels.
- Once you have selected your channels, a new tab will appear in your Visual Studio project. If you have already set up your task in MAX and selected Copy Global Task this new tab will also appear.This tab is identical to the one you would set up in MAX. Here you can configure voltage ranges, scaling, timing, and triggering, along with adding channels.
In the Solution Explorer window you will see your task, such as DAQmxTask1.mxb. Right-click on the .mxb file and select View Code. This is the autogenerated task configuration code.
Now you will need to create a user control for your DAQmx Task.
- Select File»Add New Item.
- In the dialog box, select Measurement Studio under Catagories and DAQmx User Control under Templates.
- Click Open. Select which Task you would like to create the user control for, and select Next and Finish.
Note: You must have Measurement Studio Professional or Enterprise Edition installed in order to use the DAQ assistant with Visual Studio. The Standard Edition of Measurement Studio does not include the DAQ Assistant. For more information see
Using the DAQ Assistant in Measurement Studio below.
You can now use this task in your Visual C# or Visual Basic program for data I/O.
Related Links: Developer Zone Tutorial: Using the DAQ Assistant in Measurement StudioDeveloper Zone Tutorial: Using NI-DAQmx in Text Based Programming EnvironmentsKnowledgeBase 3PBABR88: Locations for the NI-DAQmx .NET Help Files
Attachments:
Report Date: 09/28/2004
Last Updated: 02/17/2009
Document ID: 3DRCDETY