LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with Reading, Charting and Saving multiple analog and digital signals

Hi all,

 

I am looking for some help with reading multiple analog and digital signals. Once read, I would like to chart and save the data for later analysis.

I have a working version for one analog and one digital signal (Analog and Digital - Working.VI).

The problem starts when I add a second digital channel as per 'Analog and Digital - Not-Working.VI. I get the error 201105 and can only chart and save data from the analog signal and one digital signal. I have tried several alternative metods such as reading two channels  using one 'DAQmx Create Channel' which stacks up the digital signals. As I want them seperate, I have tried to convert them into a bolean array and then indexing the array to split the signals but this fails to record either of the digital data (Both Digital Signals though One DAQmx.vi).

 

I have attached the working VI with one analog and one digital signal and the non-working VI with and additional digital signal.

Any help or adivice would be appreciated!

 

 

 

0 Kudos
Message 1 of 4
(2,964 Views)

I only opened the "Both Digital Signals through One DAQmx.vi". So my comments for this VI:

  • You specify two channels for the Digital part, but you use the Polymorphic 1Chan NSamp. If you specified two channels, use the NChan NSamp version of the DAQmx Read function
  • You do several data transformation on the results in the while loop, it looks strange to me what you do, you could just save simply the waveforms, no?
  • I would not use File logging Express VI specially in a data acquisition loop, it decreases performance.
  • For such cases, I always use a proper Producer/Consumer pattern. Only perform the two DAQmx Read tasks in the While loop, and Enqueue the results into a queue. Then after Dequeue-ing the data in the Consumer while loop, you can work on this data without "disturbing" the DAQ in the top Producer loop. I would use TDMS low level file functions to save the results into a file in the Consumer loop.

edit: You should also use two DAQmx Clear Task functions after the loop to properly release the HW resources.

Edit2: when you specify the DAQmx Read function as "NChan NSamp", then you also need to tell the driver to use two channels for the two lines:

 

Both Digital Signals through One DAQmx-v2_BD.png

0 Kudos
Message 2 of 4
(2,937 Views)

The VI below (snippet: http://www.ni.com/tutorial/9330/en/ ) can give you some idea how to create a Producer/consumer pattern. Finish the data logging part, if you get problems with that part, post your actual VI and we can help and advice.

 

Both Digital Signals through One DAQmx-v2_BD.png

 

 

 

 

0 Kudos
Message 3 of 4
(2,929 Views)

Thanks Blokk for reviewing my VI and making some suggestions on how to make it work.

I will try and complete the design and see if I can make it work. I will let you know how I get on.

 

 

0 Kudos
Message 4 of 4
(2,905 Views)