From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

DAQmx Queued State Machine

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

This code is an empty template that shows how to pass DAQmx data into a queue to control the states of a state machine.

 

Description

This VI reads a continuous digital input and pass that data into a queue. The data is then dequeued into a seperate state machine loop. This is very useful if you want to control your software to perform different tasks based upon the digital input data you are collecting. You can edit the various states by right clicking on the enum and selecting edit items. You can then enter values to choose which states will correspond with which digital input values.

 

Requirements

Software

  • LabVIEW 2012 or compatible
  • NI-DAQmx 9.5.5 or compatible

Hardware

  • NI Multifunction DAQ Device

 

Steps to Implement or Execute Code

  1. Right Click on the Enum Constant and select Edit Items to edit which items correspond to which numeric value.
  2. You can also add logic between the DAQmx Read.vi and the enqueue element to determine which values you actually want to enqueue.
  3. Fill the state machine with your own code.
  4. Run the VI.

 

Additional Information or References

 

搜狗截图17年01月21日1831_7.png

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

 

 

 

 

 

 

 

 

Applications Engineer
National Instruments

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