01-05-2010 01:56 PM
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.
Solved! Go to Solution.
01-05-2010 02:54 PM - edited 01-05-2010 02:56 PM
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
There is a timeout event (set to 100mS) that is not pictured and does nothing
Just add data loging to your file
01-07-2010 11:17 AM
01-07-2010 11:55 AM
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:
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
01-07-2010 04:34 PM - edited 01-07-2010 04:34 PM
01-11-2010 01:47 PM - edited 01-11-2010 01:51 PM
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.
01-11-2010 01:53 PM
01-11-2010 03:44 PM
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
01-12-2010 01:59 PM