Example Code

Convert an Analog signal to a Digital Signal Using DAQmx

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 shows one way to convert an analog signal to a digital signal using LabVIEW.

Description
It monitors an analog input signal, and outputs a corresponding digital high or low depending on what the analog voltage is.  If the voltage rises above 2.8V, a digital high is output.  If the voltage drops below 0.8V, a digital low is output. As a note, we can leverage hysteresis fuction if we encounter any bouncing issue.

Requirement
LabVIEW 8.2 or compatible
NI-DAQmx 8.9 or compatible

Step to execute code

  1. Configure physical channel for Analog Input and Digital Output. We can also channel from simulated device for this example.
  2. Run VI.

scfp-14698.jpg

 

Additional Information or References

VI Snippet

snippet.png

Gary P.
Applications Engineer
National Instruments

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