NI-DAQmx Base Error -200428

Updated Mar 30, 2020

Reported In

Software

  • LabVIEW Full

Driver

  • NI-DAQmx Base

Issue Details

I wrote an NI-DAQmx Base application and I am getting Error -200428, and the possible reason(s) shows Value passed to the Task/Channels In control is invalid. The value must refer to a valid task or valid virtual channel. What am I doing wrong?

Solution

This error indicates that you are configuring your task incorrectly. As you may know, there are two types of tasks: Dynamic Tasks and Static Tasks. Dynamic Tasks are created manually in LabVIEW, Static Tasks are generated from the NI-DAQmx Base Configuration Utility. 
  • Dynamic Task
Anytime you create a Dynamic Task, you need to put down the DAQmxbase Create Task VI before the DAQmxbase Create Channel VI. If you don't put them in this order, you are going to recieve the error mentioned above. Remember this is the case for DAQmx base only, because in the normal DAQmx API (not the base), you can put down a DAQmx Create Virtual Channel VI without the DAQmx Create Task VI and not get the error. This is because the driver automatically creates the task for you. Finally, you need to put down at the end of your program both the DAQmxbase Stop Task VI and the DAQmxbase Clear Task VI.
  • Static Task
When creating a Static Task, you only need to put down the DAQmx Task Name in the Block Diagram and write down the name of the task you created in the NI-DAQmx Base Configuration Utility (remember that you can't select the task by right clicking the Task Name and selecting browse. Only Tasks created in MAX appear on that list, not the ones created on the NI-DAQmx Base Task Configuration Utility.) After the DAQmx Task Name you only need to put down the Start Task VI. Finally, you only need to put down the Stop Task VI, you don't need the Clear Task VI. The Clear Task VI is only used when creating Dynamic Tasks.

Additional Information

You can find an example on how to use a static task here: Using a DAQmx Task Created in MAX in LabVIEW