Working with National Instruments devices

Introduction

Working with Tasks

The entire support for National Instruments devices is based on tasks (do not confuse with Task macrofilters).
A task in Adaptive Vision Studio is a single channel. Every task is associated with an ID, which is necessary for configuring tasks, reading states from inputs or writing values to device outputs.

Creating Tasks

To start working with National Instruments' devices, a task that will perform a specific operation must be created.
For this purpose one of the filters from list shown below should be selected.

Starting Tasks

Finishing Tasks

There are two ways of finishing tasks: by using the DAQmx_StopTask filter or by waiting for the entire program to finish.
It should be noted that you cannot start two tasks using the same port or channel in a device.

Sample Application

The following example illustrates how to use DAQmx filters. The program shown below reads 5000 samples of voltage from analog input. However, data is acquired on rising edge of a digital signal.

At first, analog channel is created. In this sample, input values will be measured, so inCVType input must be set to Voltage and inIOType should be set to Input. The rest of inputs depends on used device.

Afterwards, sample clock to task is assigned. inDeviceID input might be set to Auto, because it is the only one device used in this program. Other parameters could be set according to user's camera.

Sample application should start acquiring data after a digital edge occurs. Because an active edge of digital signal should be rising, inTriggerEdge input must be set to Rising (for falling edge, value Falling must be chosen). Task is ready to start.

Last step in presented program is to acquire multiple data from selected device. Filter DAQmx_ReadAnalogArray could be used for this. DAQmx_StopTask is not required, because this program doesn't use one channel in two different tasks.
Acquired array of values might be represented e.g. as a profile (shown below).