Example Code

DAQ Multiple Uses of Task (Digital IO and Counter)

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Hardware

  • Data Acquisition (DAQ)

    Software

  • LabVIEW

    Driver

  • NI DAQmx

Code and Documents

Attachment

Overview
The example shows a simple VI using the three parallel lines of DAQ tasks in a single VI

Description:
This example shows how to set up an application that does several types of DAQmx tasks on one module. This code shows how to set up 4 digital lines for input 3 for output and 1 line for counter input. This example is set up to use the 9401 in Slot 5 of a 9172 compact DAQ chasis, but this code will work form many DAQmx devices

Steps to implement or execute code
To implement this example:
  1. Run the VI
  2. (Optional) Turn on the Highlight Execution to see the flow of the VI


To execute this example:

  1. Install the required software.
  2. Connect the DAQ hardware that supports the DIO and Counter features
  3. Confirm the connection with the MAX with TestPanel
  4. Open the VI and refer the Implement Steps


Requirements
Software
LabVIEW 2012 or compatible
NI-DAQmx 16.0 or compatible

Hardware
cDAQ with C series Digital IO and COunter Input Module

 

fp.JPG

 

bd.JPG

 

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Mr._NiceGuy
Member
Member
on

I have been spending the better part of a day trying to get the 9401 to multitask in a 9174 chassis. This VI was very helpful in designing the layout, however, you must reserve each of the tasks before they run or it will throw an error. This is related to the need to briefly reserve all lines for communication of the new line configurations (see section 4-16 of the manual, http://www.ni.com/pdf/manuals/372838c.pdf)

For testing purposes I've modified this VI to do a counter output so I could feed this back into the digital inputs for viewing the signal. Success!DI-DO-CO.png

YogeeshBK
Member
Member
on

Mr._NiceGuy, would you please attached modified vi?

feesho
NI Employee (retired)
on

 To anyone still working on this, I find that the order in which you start the tasks to also be important. The following seems to work best for me:

 

Reserve DO -> Reserve Counter -> Start DI -> Start Counter -> Start DO