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

Compare Analog Input Signal then Send Digital Output Signal

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 example is intended to read in two Analog Input Voltage channels and compare analog input channel 2 to a set voltage. 

 

Description

If the voltage on analog input channel 2 is greater than or equal to 2.2 Volts a digital signal of true will be sent. If the voltage on analog input channel 2 is less than 2.2 Volts a digital signal of false will be sent. This program will continue to acquire the two channels of data until the stop command has been pressed.

 

This program is intended to use whenever you need to compare a voltage on a channel to a set voltage and if that voltage is greater than act upon it. This corresponds to the digital signal of true being sent when the value of analog input channel 2 is greater than or equal to 2.2 Volts. The original intention of this product was to close a relay if the voltage exceeded a 2.2V threshold.

 

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. Configure the parameter for the right channel and device.
  2. Connect your hardware appropriately.
  3. Run the VI.

 

Additional Information or References

 

 

Compare Analog Input Signal to Constant to Senda Corresponding Digital Output Signal.jpg

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

National Instruments
Applications Engineer

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