LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuous aquisition of N Samples

Solved!
Go to solution

Hi - Hopefully this will be an easy question to answer.

 

I am reading in an analog voltage.  I need to acquire 20 samples every time the voltage goes above 0.1 V.  What is the best way to set this up?

 

I tried putting an N-samples acquisition in a while loop with an analog edge trigger (rising at 0.1V), but it misses most of the voltage peaks (the data rate is 1 MHz and the voltage will go above 1 V about 1000 times a second).

 

Thanks for your help!  (I attached the VI if you want to see what I've got)

 

Jeremy

0 Kudos
Message 1 of 12
(3,386 Views)
The size of the array has nothing to do with the number of elements in each dynamic signal. Building an array dynamic signals is not really a very good idea any way but in order to look at the number of samples acquired, you would have to index the array and look at each signal. All that you are doing now is looking at how many times the loop iterated.
0 Kudos
Message 2 of 12
(3,371 Views)

Ah, I didn't even catch that.  Although the loop should have still executed 1000 times per second, instead it only executes 8 or 9.  (I know the solution I'm using can't do that, but I'm look for one that can).

 

Thanks.

0 Kudos
Message 3 of 12
(3,368 Views)

I attached an updated VI so there is no array of dynamic signals and it reads the number of samples and not the number of iterations.

 

I would really, really appreciate it if someone could help me out here.

 

Thanks,

Jeremy

Message Edited by mets501 on 07-06-2009 09:30 AM
0 Kudos
Message 4 of 12
(3,341 Views)
With each iteration of the while loop, you will acquire 20 samples. The DAQ Assistant and the while loop is not running 1000 times in 1 second in order to get your 20000 samples. Create an indicator for the iteration terminal and see what the actual count is. What I would recomend is using the low level DAQmx functions where you create and start/stop the task outside the loop and only have a DAQmx Read inside.
0 Kudos
Message 5 of 12
(3,332 Views)

Alright, now we're sort of getting somewhere.  See the attached VI.  It works fine except I need the loop to execute every time the trigger is "activated".  Right now it just loops continously reading in 20 samples after the first trigger.  I need exactly 20 samples after each trigger.

 

Thanks,

Jeremy

0 Kudos
Message 6 of 12
(3,324 Views)
Solution
Accepted by topic author mets501
Look at the example called Acq&Graph Voltage-Int Clk-HW Trig Restarts.vi. I think what you need to do is start and stop inside the loop. Sorry, I forgot that you were doing triggering. I also noticed that the triggering conditions in the last VI do not match what you were using in the DAQ Assistant. You have edge triggering in the last and previously you were using an analog trigger.
Message 7 of 12
(3,305 Views)

That's pretty much exactly what I needed!  I noticed that there is a "recover time" of about 35 ms before it can accept another trigger after the previous trigger, however.  Is there any way you can think of to speed that up, or is that just the limitations of the hardware?

 

Thanks for your help,

Jeremy

0 Kudos
Message 8 of 12
(3,292 Views)
I'm not sure if you can reduce the time and if you can, by how much. I seledom use hardware tiggering. I do see in the example, a DAQmx Control Task with a commit action wired to it. The comments indicate this allows for efficient restarts.
Message 9 of 12
(3,284 Views)

Yeah, the commit is 30 Hz "efficient" but not 1 kHz efficient.

 

Thanks,

Jeremy

0 Kudos
Message 10 of 12
(3,278 Views)