To download NI software, including the products shown below, visit ni.com/downloads.
Overview
To demonstrate how to merge the acquisition of the analog and digital signals into one graph
Description:
The attached code is designed to do something that sounds really easy, but is deceptively tricky. It sets up and synchronises two tasks an analogue and a digital task; both with multiple channels acquiring continuous data. Both tasks output waveform data.
This is the tricky part! Digital waveform data cannot be plotted together on the same graph or chart as analogue waveform data (the digital data can't be plotted on an ordinary chart or graph). LabVIEW does have something called a combination analogue and digital waveform graph, but this still doesn't plot the digital and analogue data on the same axes.
The project attached below contains a subVI called "Convert Digital Waveforms to analog waveform.vi". This VI takes an input of the DAQmx Digital task refnum and the digital waveform. It determines how many channels were in the task, separates each channel of digital data from the others and turns it into an array of analogue waveforms. These can then be output to the main VI where they can be plotted on a graph alongside the analogue waveforms or processed as needed.
This code was designed with a compactDAQ chassis containing an analogue and a digital card in mind, but would work on an X-series card or a PXI chassis with an analogue and a digital card too. Each folder contains a .ini file that can be used to set up a simulated device on your PC to make the code work.
Steps to implement or execute code
To implement this example:
To execute this example:
Requirements
Software
LabVIEW 2012 or compatible
NI-DAQmx 9.0 or compatible
Hardware
cDAQ with C series Analog Input and Digital IO Module
**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.
Hello Vsenior,
I am attempting to use your VI as a template for plotting AI and DI on the same waveform chart but I am encountering an "Error 1806 at DWDT Digital Signal Subset.vi" within "Convert Digital Waveforms to analog waveform.vi" saying "Signal value input is outside the range of the digital data." Can you provide any insight as to why this error might be occuring?
HI Apollo_s,
I don't know why it's giving that exact error but the message "Signal value input is outside the range of the digital data" suggests that something about the waveform that you've wired in isn't quite right. I'd check what you've wired in to see if there's anything that's different from what I posted.
You might consider getting in touch with your local NI office for technical support if you can't resoolve the problem. They can take a look at your VI and advise you.