NI-DAQmx VI and Function Reference

Content Type
Programming Language
Current manual

DAQmx Create Task (VI)

DAQmx Create Task (VI)

Owning Palette: DAQmx Advanced Task Options VIs and Functions
Installed With: NI-DAQmx

Creates a task and adds virtual channels to that task if you specify them in the global virtual channels input. If you specify a task to copy, this VI duplicates the configuration of the specified task in the newly created task before it adds any additional global virtual channels.

If you use this VI within a loop, NI-DAQmx creates a new task in each iteration of the loop. Use the DAQmx Clear Task VI within the loop after you are finished with the task to avoid allocating unnecessary memory. Refer to Task Creation and Destruction for more information on when NI-DAQmx creates tasks and when LabVIEW automatically destroys tasks.

DAQmx Create Task

civrn.gif

task to copy is the name of a task to make a copy of.

civrn.gif

global virtual channels specifies a global virtual channel or list of global virtual channels to add to the task.

A DAQmx global channel constant lists all global virtual channels on the system.

If you have an array of global virtual channels, use the DAQmx Flatten Channel String VI to convert the array to a list.

cerrcodeclst.gif

error in describes error conditions that occur before this VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. If an error occurs while this VI or function runs, the VI or function runs normally and sets its own error status in error out. Use the Simple Error Handler or General Error Handler VIs to display the description of the error code. Use error in and error out to check errors and to specify execution order by wiring error out from one node to error in of the next node.

cbool.gif

status is TRUE (X) if an error occurred before this VI or function ran or FALSE (checkmark) to indicate a warning or that no error occurred before this VI or function ran. The default is FALSE.

ci32.gif

code is the error or warning code. The default is 0. If status is TRUE, code is a negative error code. If status is FALSE, code is 0 or a warning code.

cstr.gif

source identifies where an error occurred. The source string includes the name of the VI that produced the error, what inputs are in error, and how to eliminate the error.

cstr.gif

new task name is the name to assign to the task. If you use this VI in a loop and specify a name for the task, you must use the DAQmx Clear Task VI within the loop after you are finished with the task. Otherwise, NI-DAQmx attempts to create multiple tasks with the same name, which results in an error. Refer to Task Creation and Destruction for more information.

cbool.gif

auto cleanup specifies if LabVIEW automatically destroys the task when the application completes execution. If auto cleanup is FALSE, LabVIEW does not automatically destroy the task until you exit LabVIEW. Use the DAQmx Clear Task VI to manually destroy the task.

iivrn.gif

task out is a reference to the new task.

ierrcodeclst.gif

error out contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, error out describes the error status that this VI or function produces. Right-click the error out indicator on the front panel and select Explain Error from the shortcut menu for more information about the error.

ibool.gif

status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred.

ii32.gif

code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.

istr.gif

source identifies where and why an error occurred. The source string includes the name of the VI that produced the error, what inputs are in error, and how to eliminate the error.

Was this information helpful?