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:
Define the Analog Channel Parameters and Digital Channel Parameters to be used. Select your analog and digital channels on the front panel. Then go to the block diagram.
Set the Timing Parameters as needed
Run the VI
(Optional) Turn on the Highlight Execution to see the flow of the VI
To execute this example:
Install the required software.
Connect the DAQ hardware that supports the Digital IO and Analog Input features
Confirm the connection with the MAX with TestPanel
Open the VI and refer the Implement Steps
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.**