LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

digital trigger to stop/start analog data acquisition

Solved!
Go to solution

Rod:

Thanks for your direction. I am fairly new in Labview world. As per attached vi, I can start acquisition using PFI0. I have AI1, AI2 and AI3 analog inputs available but have a tough time to implement your idea for stopping acquisition when voltage drops to zero (or a specified voltage). Can you help me to complete the attached vi as per your recommendation.

I am using labview 8.2, if you decide to complete the vi, please send also .jpg of the front panel and block diagram in case I cannot open your vi, I can recreate your vi using the jpg's.

Many thanks in advance.

 

David T.

0 Kudos
Message 11 of 29
(2,994 Views)

Hi David T.,

 

Most likely some of the issues that you are running into stem from the fact that you are reading multiple channels and samples as a waveform.  So to do any kind of comparison, you are going to have to:

 

1) decide which channel you want to test -> use Index Array.vi

2) pull out the data from the waveform -> use Get Waveform Components.vi

3) decide which sample to compare to your setpoint -> use another Index Array.vi

 

See the screenshot below:

 

issue.png

Have a great day,

 

Chris V

 

Applications Engineer
National Instruments
0 Kudos
Message 12 of 29
(2,973 Views)

Hello David,

 

Chris is correct that you will have to index out the channel you want.  The only edit I would make to his example is to use the Array Max & Min function and pull out the maximum value from the array to see if it has exceeded the threshold.  

 

stop.png

Rod T.
0 Kudos
Message 13 of 29
(2,969 Views)

Chris and Rod:

Thanks for all the tips. I revised the vi as you recommended (see attached). Your recommended threshold sensing part works perfect. But now the start trigger (PFI0) does not work.Here is why:

 

On my 6009 DAQ module, I am using AI0 Analog input for analog acquisition of a pulse train voltage (see attached). For this purpose, I am using the raising edge of my voltage pulse signal to start the acquisition, hence I have attached PFI0 input (start trigger) of DAQ module to analog AI0 input. When voltage signal reappears at AI0 input, PFI0 is supposed to kick start acquisition but the threshold sensing section does not allow the acquisition to start because the Start rigger signal is the rising edge of the voltage pulse which starts at zero which is below the threshold.  Is there any way work around this? Perhaps, we need to delay the reaction of threshold sensing section so that the input has time to go above the threshold at the start of voltage pulse? 

 

Look forward to your inputs.

 

Thanks in advance.

0 Kudos
Message 14 of 29
(2,950 Views)

Hi David T.,

 

Yes, what you proposewould work.  I would do another thresholding function to check and see if the signal has risen about the required value yet.  If not, then disable our threshold to stop.  Once the signal has gone above this level, set a boolean to true that enables the thresholding.

 

At least that's one way to do it.

 

Have a great day,

 

Chris V

Applications Engineer
National Instruments
0 Kudos
Message 15 of 29
(2,932 Views)

Chris & Rod:

Chris, I attempted your solution but unable to implement as you described in your last post. Can you send me the png of what you describing?

I attempted a different way. I rounded and filtered the signal to get rid of the noise. Then I used shift registers and "less" function to obtain the trend of the curve. If the signal is increasing (such as at start up), then the threshold circuit will be disabled. But if the signal is decreasing such as when curve is decaying toward the threshold, then the circuit is enabled. BUT, for some reasons, the vi does not work as intended.  Can you look it over and see where I am going wrong?

 

Thanks in advance.

0 Kudos
Message 16 of 29
(2,917 Views)

Hi David,

 

SInce you need to determine slope, it would be much easier to use the built in Basic Level Trigger Detection VI.

trigger.png 

Rod T.
Message 17 of 29
(2,915 Views)

Rod:

Thanks for recommending the Trigger Detection vi. It works great!!!! Now with this vi, I can stop the sampling in 6009 DAQ module.

I have an issue to work out, I hope you can recommend a solution:

When I press RUN button in my vi, the "DAQmx Start Trigger" vi starts (when a falling edge signal is provided by my test fixture) the acquisition and the "Trigger Detection" vi stops the acquisition and correct data array is written into a lvm file. But, the next trigger signal from my test fixture DOES not start the acquisition. To get around this, instead of pressing RUN button, I press RUN CONTINUOUSLY button which allows for the next start triggers to start acquisition BUT when Stop triggers stop the acquisition, wrong data is written into lvm files. The first value in the array in the lvm is correct but the rest are all zero's. Can you recommend a solution so that I can repeatedly start/stop the acquisition and have correct data array in the lvm files? Very much appreciate your input.

 

Thanks in advance and hope to hear from you soon. 

 

Attached is the latest vi I am using.

0 Kudos
Message 18 of 29
(2,871 Views)

Hello David

 

I am currently researching this matter.  Thank you for your patience!

Sincerely,

Greg S.
0 Kudos
Message 19 of 29
(2,851 Views)

Greg:

The vi (see attached) is partly working but I get an sampling error (see attached). 

 

My requirement:

1.    Activate the vi using “Run Continuously” button.

2.    Start data acquisition when Start trigger is asserted.

3.    and stop acquisition when input voltage falls below a threshold

4.    and immediately write the acquired data (between start and stop trigger action) into a file. 

5.    Automatically repeat steps 2 thru 4 as many times as required.

 

Ideally I want the vi to stop sampling when STOP button in asserted (when voltage falls below threshold) and immediately write the data into a file. But I do not know how to make the vi to do so.

Instead, (since the duration between start and stop trigger is approximately 6 minutes.) I am setting the vi to perform data acquisition for 7 minutes (420 seconds) by setting the Rate to 10 and Sample to Read to 4200. But after 7 minutes, I get an error (attached).

 

I followed the possible solutions in the (attached) Error message but to no use. I specified fixed number of samples, still got the same error. I increased the Rate to 100 and Read to 42000 (for 7 minute acquisition) and still got the error. Finally I added Input buffer vi to increase the buffer size to 100000 and still got the same error.

 

Can you advise:

1.    How I can only acquire data between Start and Stop triggers.

2.    If above (1) is not possible, what value should I set the Rate and Read to get 7 minutes of data without getting an error.

 

Thanks in advance.

 

0 Kudos
Message 20 of 29
(2,828 Views)