LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to plot multiple collection trials on side by side graphs

Solved!
Go to solution

I'm trying to create a DAQ data collection VI.  I'm using an e series PCI DAQ card, and collecting from 8 analog inputs.  What I want to do is store the data in some sort of table, and display graphs of the 3 most recent collection periods.  The VI runs continuously, but it only collects when a boolean switch is activated.  I'm attaching my VI as it is now, (forgive its crudeness) so any advice is welcome.

 

0 Kudos
Message 1 of 9
(4,045 Views)

OK----

A few tips

 

1) Remove the flat sequence.  If you need to sample the channels in order you can use error in(no error) and error out to enforce data dependancy.  Its more likely that you would want to sample all chanels at the same time if so select the  instance DAQmx Read.vi (Analog [DBL or WFM] N channel 1 sample)

 

2) you need to start and stop your tasks explicitly do not depend on the autostop property to do this

 

3) Consider setting the sample rate and number of samples by wiring them to a Task Timing vi

 

4) Consider using an event structure

 

Here's an example

DAQmx.png

 

There is a timeout event (set to 100mS) that is not pictured and does nothing

 

Just add data loging to your file

Message Edited by Jeff Bohrer on 01-05-2010 02:56 PM

"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 9
(4,034 Views)
Thanks for the response, Jeff, it improved the performance of my VI a lot.  Do you have any ideas about how to plot the 3 successive trials side by side?
0 Kudos
Message 3 of 9
(3,996 Views)

Hi Cnorris,

 

I wanted to add on to Jeff Bohrer's example a little bit. Instead of using an event structure you can use a case structure (similar to what you were doing in your example) to determine when to sample and write to file. I would recommend setting it up to use a single DAQmx Task with multiple channels and use a DAQmx Timing VI to set up the sample rate and number of samples to acquire (you called this Sample Period (s) in your example. Jeff illustrated how to do this in his example. Here is a modified version implementing my suggestions:

 

daqmx_sample_write_when_true.png

 

As far as showing the three most recent collection periods, depending on exactly what you are looking for, you can probably do this with a Waveform Chart if you modify the Chart History to be equal to three times the number of Sample Periods you desire.

 

I hope this is helpful!

 

Thank you for choosing National Instruments.

 

Aaron

National Instruments

Applications Engineer

http://www.ni.com/support

 

0 Kudos
Message 4 of 9
(3,992 Views)
Solution
Accepted by Cnorris
Daqx3.pngHeres one way! there a many others.  It lacks some beauty but still allows extensability to handel other events
Message Edited by Jeff Bohrer on 01-07-2010 04:34 PM

"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 9
(3,973 Views)

Jeff, I'm trying to do what you've shown here, which looks like exactly what I want.  My program doesn't seem to be storing the data from previous trials though, like the shift registers aren't doing their job.

I checked the number of elements in the 2d array, and it never goes above 1.

Message Edited by Cnorris on 01-11-2010 01:51 PM
0 Kudos
Message 6 of 9
(3,930 Views)
You don't have the shift register wired through in the timeout event. You don't even need the timeout event here so it could be deleted.
Message 7 of 9
(3,925 Views)

Dennis Knutson wrote:
You don't have the shift register wired through in the timeout event. You don't even need the timeout event here so it could be deleted.

Nice catch- I was attempting to demostrate limited extensability ( certainly, if the event structure got much busier a new queued loop should be spawned) Without overly complicating the basic needs of the OP. 

 

Thanks Dennis for pointing it out


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 9
(3,911 Views)
My program is working.  Thanks, guys 🙂
0 Kudos
Message 9 of 9
(3,876 Views)