LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Start and stop logging using digital triggers

Hi,

I’m trying to use digital triggers to start and stop measurement. Program is supposed to wait until start trigger happens, then create a measurement file and start logging to file until stop trigger. I’m using PFI1 as start trigger and PFI5 as stop trigger (PFI0 is already in use for other purpose). When logging has been stopped, program should start to wait again for start trigger.

The problem is that I’m not able to restart logging after first stop, unless I use very slow acquisition rates (when there is no backlog). I have tried DAQ occurrences and AI read in while loop to wait for start trigger. AI is cleared after each stop.

Any ideas how to solve this problem?

Thanks in advance,

Jakke

0 Kudos
Message 1 of 9
(3,643 Views)

According to your descprition I think what can help you are nested loops.

Have a look at the attached vi.

Hope this helps.

Thomas

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 9
(3,637 Views)

Thanks, but unfortunately that didn't solve the problem.

I made an example code (LV 7.1.1) without file writing functions. PFI5 and PFI1 trigger lines are used in this example. I included two solutions I tried for detecting start trigger: DAQ occurrence and AI read.

When measuring for example one channel at 1000 scans/sec, there's no backlog and I'm able to start and stop measurement using triggers. But when I rise channel count for example to four, backlog doesn't remain zero and measurement won't start after first stop. I'm using DAQPad-6020E.

Thanks in advance,

Jakke

0 Kudos
Message 3 of 9
(3,627 Views)
Could you post it as LV7.0 (Menu File >> Save with options >> Save for previous version)?
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 4 of 9
(3,623 Views)
I'm not at my project right now, but I'll do that tomorrow.
 
I noticed one interesting thing: same project works great with DAQCard AI-16XE-50 measuring all 16 channels at 1000 Hz. Backlog stays at low level all the time. With DAQPad backlog doesn't stay at zero unless acquisition rate is something like under 3 kS/s. Why is that?
0 Kudos
Message 5 of 9
(3,615 Views)
Ok, now it's saved in 7.0 format.
0 Kudos
Message 6 of 9
(3,601 Views)
I somehow can't follow your ideas. I attach the vi again with additional comments.
Could you have a look at it and try to clearify your vi?
 
Thomas
 
btw - are you from Finland?
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 7 of 9
(3,597 Views)

Thanks becktho,

Idea of the first loop is to wait until start trigger happens. In final application measurement file is created right after start trigger happens (this is important). After file is created measurement loop starts. I know there's no stop condition in case of an error, but this example is only a simplified version of the full program.

AI read is set to read one second of data or remaining backlog if it's more than one second. Reason for this is to prevent measurement running out of buffer in all situations.

So basicly program is meant to progress like this:

wait until start trigger -> create measurement file -> log data to file until stop trigger (or exit) -> wait again until start trigger -> new measurement file....

 

And yes, I'm from Finland 🙂

Jakke

0 Kudos
Message 8 of 9
(3,593 Views)
Ok - I haven't used digital triggering up to now. So I can't help you on this topic.
I think all occurence vis are not necessary. This would be rather helpful if you want several tasks to start at the same time (and obviously I don't want to do that).
The rest looks good to me except the placement of the stop-button. If you get stuck in the first loop you can't stop the vi (ok - the red one in the task bar, but this is no option to me usually).
 
The different execution behaviour in dependence to the hardware used - I actually don't see a reason for that. As you say that the problems may be some kind of dependent to the backlog size, try to set a fixed number of scans.
 
I can't test the vi on my desktop, as there are no daq-cards in there and I still don't use the latest daq-version (so no simulated devices) - and just by looking at it is difficult.
 
But anyway - have a try and come back.
 
Thomas
 
p.s.: I've been to Finland this summer - great!! Smiley Wink
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 9 of 9
(3,588 Views)