This series aims to help you make the transition from using Traditional NI-DAQ (Legacy) and Microsoft Visual Basic 6.0 to NI-DAQmx and Microsoft Visual Basic .NET.
The Traditional NI-DAQ (Legacy) driver is being obsoleted. NI-DAQmx is the new, recommended driver that is designed for use with some of the newest data acquisition devices available from National Instruments.
NI recommends using the native .NET application programming interface (API) that is optimized for use with the .NET framework to create DAQ applications in Visual Basic .NET.
Refer to the Traditional NI-DAQ (Legacy) Overview and NI-DAQmx Overview sections for more information about the different solutions available to you.
This series assumes that you are familiar with creating data acquisition applications using the Traditional NI-DAQ (Legacy) CWDAQ ActiveX controls with Visual Basic 6.0. Even if you have not used the Traditional NI-DAQ (Legacy) CWDAQ ActiveX controls, you can use this document as an introduction to using the NI-DAQmx .NET API to create data acquisition applications in Visual Basic .NET.
National Instruments provides several solutions for developing data acquisition applications (DAQ). The following table lists options available to you based on the current versions of NI data acquisition drivers and Visual Basic.
This series references two main types of reference manuals that ship with NI-DAQmx.
See Also:
Microsoft Visual Basic Developer Center
The CWDAQ controls are organized based on the type of operation they perform. The following table provides an overview of the available controls.
NI-DAQ ActiveX control | Purpose
|
CWAIPoint | Acquires one point of data from one or more analog input channels to monitor slowly changing processes, such as temperature. Use CWAIPoint methods such as SingleRead to acquire a software-timed measurement from the configured device. |
CWAI | Performs continuous hardware timed acquisition operations with various configuration operations. You can use this control to acquire data from one or more channels and to configure many different modes, such as start and stop triggers, pause conditions, and different channel and scan clocks. Use this control for applications that require high sampling rates on multiple points per channel, such as frequency analysis. |
CWAOPoint | Performs single-point software-timed analog-output operations. Updates one or more analog output channels for slow process control systems, such as setting a control output. |
CWAO | Performs hardware-timed analog-output operations with various configurations. The waveform generation can be run in a continuous or finite mode. Use this control for applications that require dynamic analog signals, such as testing of analog devices. |
CWDIO | Performs single-point updates or reads on the digital lines of a data acquisition device. You can use the CWDIO control to control the state of a physical device (such as a valve, relay, or LED) or read the current state of a similar device (such as a switch or light gate). |
CWDO | Performs buffered digital waveform output. You can generate a digital pattern from the digital outputs at a rate specified by an external signal or internal clock. |
CWDI | Performs buffered waveform digital input. You can acquire data from your digital input at a rate specified by an external signal or internal clock. |
CWPulse | Generates individual pulses and pulse trains with the counter/timer component on a data acquisition device. |
CWCounter | Counts or measures incoming digital pulses using the counter/timer components on a data acquisition device. Typical operations include counting a number of events, measuring the period of an unknown pulse, or measuring the frequency of a signal. |
CWDAQTools | A utility control for Traditional DAQ. This control provides functions for scaling transducer values and configuration options not present in the other controls. |
These controls are designed for Visual Basic 6.0 and are organized based on the hardware operation that is required. Because of the way the controls are organized, it is not always intuitive which controls should be used for a specific measurement task. You must ensure that the acquired data is processed correctly to provide meaningful results, since the CWDAQ controls are not aware of the kind of measurement being made or whether the data acquired is coming from an RTD, thermocouple, or other transducer type. For example, if you require a strain measurement, you must ensure that the correct excitation is applied, scaling is correct, and that all the strain gauge parameters are set correctly. You also need to manage any scaling or unit conversion. These settings are not directly configurable using the CWDAQ controls.
Due to the nature of Visual Basic 6.0 and some limitations of Traditional DAQ, creating multi-threaded, object-oriented DAQ applications with the Traditional NI-DAQ (Legacy) CWDAQ controls is a complex process.
The following section introduces the NI-DAQmx driver and the NI-DAQmx .NET API and describes some of the advantages provided over Traditional NI-DAQ (Legacy) and the CWDAQ ActiveX controls.
See Also:
Answers to Frequently Asked Questions about NI-DAQmx and Traditional NI-DAQ (Legacy)
What are the Terminology Changes in NI-DAQmx?
Performance
Measurement based API
Multithreaded Driver
Improved State Model
Consistent API across all programming languages
Robustness in exceptional conditions
The NI-DAQmx DAQ framework introduces several new concepts, the two most important being Tasks and the Task State Model.
We will see how tasks are set up as we discuss the DAQmx .NET API in the following sections.
Task State Model
NI-DAQmx uses a task state model to improve ease of use and speed up driver performance. The task state model consists of five states—Unverified, Verified, Reserved, Committed, and Running.
You can choose to interact with as little or as much of the task state model as your application requires.
For more information about the task model of DAQmx, select NI-DAQmx Help » Key NI-DAQmx Concepts » Tasks » Task State Model in the NI-DAQmx Core Help.
The NI-DAQmx Help provides information about some of the other concepts of DAQmx as well. For more information, select NI-DAQmx Help » Key NI-DAQmx Concepts in the NI-DAQmx Core Help.
Visual Basic .NET has several new language features such as inheritance, interfaces, full multithreading support and structured exception handling that makes it possible for a Visual Basic developer to create multi threaded, scalable applications. You must be familiar with Visual Basic .NET to apply these new features in your applications.
This document will not discuss Visual Basic 6.0 migration to Visual Basic .NET. This migration process is not a trivial one. The Visual Basic .NET language is not backwards compatible with the Visual Basic 6.0 language. There are several resources available on the Microsoft Developers Network (MSDN) that will guide you through the new features in Visual Basic .NET and guide you through migrating applications that were created using Visual Basic 6.0. Refer to Reference section for more information.
Typical NI-DAQ Application
When framing a DAQ application, irrespective of the type of driver or device used for acquiring data, you organize the application into five main steps. The approaches to these five steps will vary based on how the data acquisition driver is organized and the functionality it provides. These steps include the following:
1. Identifying your Measurement
2. Configuring your measurement
3. Running the data acquisition operation
4. I/O
5. Cleanup
These steps provide the basic building blocks for creating a typical data acquisition application. You should be familiar with how a DAQ application uses the DAQ driver to address each of these steps to create a robust data acquisition application. We compare the NI-DAQmx .NET API with the Traditional NI DAQ (Legacy) CWDAQ controls by breaking down their functionality into these five steps. We discuss these steps in the other documents in this series. Refer to the Links to Other Topics in this Series section to access these documents.
The DAQmx .NET API is available as a part of the NI-DAQ driver. Installing support for the .NET languages install the DAQmx assemblies, shipping examples and the API reference and concept documents. The .NET API is available for free as part of NI-DAQ.
VB.NET Shipping Examples for DAQmx
C# and VB.NET shipping examples for the DAQmx .NET API are installed as part of the language support and are available under ..\National Instruments\MeasurementStudio2003\DotNET\Examples\DAQmx for Visual Studio .NET 2003 and ..\National Instruments\MeasurementStudio2005\DotNET\Examples\DAQmx for Visual Studio 2005.
NI-DAQmx Quick Start Guide
The NI-DAQmx Quick Start Guide is a great document to get your DAQ system up and running. It provides an introduction to setting up and installing NI-DAQ devices on your machine and also provides information about the various programming interfaces available for NI-DAQmx. To find out information about the programming interfaces and how to get started with them, refer to the Getting Started Developing an Application section in the NI-DAQmx Quick Start Guide. You can find the Quick Start Guide from Start » Programs » National Instruments » NI-DAQ » DAQ Quick Start Guide.
Before any code can be written, you need to identify what kind of measurement is required.
Are you measuring temperature, strain, position, or something else? Are you using external sensors that need calibration or excitation? Will the sensor data require scaling of any kind?
Once you have a good understanding of the type of measurement you will be making, the next step is to configure the operation. Refer to Transition from Traditional NI-DAQ (Legacy) to NI-DAQmx using Microsoft Visual Basic .NET: Part Two for information on configuring your operation.
This section lists other topics in this series:
See Also:
Transition from Traditional NI-DAQ (Legacy) to NI-DAQmx using Microsoft Visual Basic .NET: Part Two
Transition from Traditional NI-DAQ (Legacy) to NI-DAQmx using Microsoft Visual Basic .NET: Part Three
Transition from Traditional NI-DAQ (Legacy) to NI-DAQmx using Microsoft Visual Basic .NET: Part Four