From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

triggering

I am currently using Labview with S Series card and I am coming across an error that doesn't seem to occur with an X Series or E series. The purpose of the code is to be able to have two lines of code running simultaneously. I want to be able to continuously acquire samples from one analog input; the second channel of acquisition is to be triggered using a condition met from the first aforementioned analog input.

 

Attached is the code that I have been drafting, the issue with using two sample clocks is an error pertaining to reserved resources. The code below shows both virtual channels collected into the same task, is there a way to have two distinct tasks/channels that will function in the way described? 

Download All
0 Kudos
Message 1 of 9
(3,873 Views)

look this page

0 Kudos
Message 2 of 9
(3,859 Views)

@labm8 wrote:

I am currently using Labview with S Series card and I am coming across an error that doesn't seem to occur with an X Series or E series. The purpose of the code is to be able to have two lines of code running simultaneously. I want to be able to continuously acquire samples from one analog input; the second channel of acquisition is to be triggered using a condition met from the first aforementioned analog input.

 

Attached is the code that I have been drafting, the issue with using two sample clocks is an error pertaining to reserved resources. The code below shows both virtual channels collected into the same task, is there a way to have two distinct tasks/channels that will function in the way described? 


OK that was fun!

 

As you know you can only have one AI task per device so, you need to process the data to remove the stuff you don't want.

Thusly:

Fixed JJB Mod.png


"Should be" isn't "Is" -Jay
Message 3 of 9
(3,843 Views)

Thanks, Jeff! 

 

Can you elaborate a little more on the process behind the Trigger and threshold 1D array function (part b)? It's to my understanding that our specific trigger is to collect a finite number of samples of interest (extracting from the 2nd array) for every instance a trigger condition is met on the first acquistion channel (1st array).

 

Thanks again. 

0 Kudos
Message 4 of 9
(3,795 Views)

@labm8 wrote:

Thanks, Jeff! 

 

Can you elaborate a little more on the process behind the Trigger and threshold 1D array function (part b)? It's to my understanding that our specific trigger is to collect a finite number of samples of interest (extracting from the 2nd array) for every instance a trigger condition is met on the first acquistion channel (1st array).

 

Thanks again. 


Sure What that little piece of the puzzle does:

The first acq channel data is extracted and passed into Threshhold 1D array.  Each element of the array is compared to the threshold value until two points are found where there is a positive crossing of the threshold the fractional index of the crossing is returned (eg the array is [1,2,3,4] and the threshhold is 2.65 the fractional index is 1.65 since the crossing is at 65% if the difference between elements 1 and 2)

If no crossing is found the returned index is the index of the last element of the array.  We use that value (coerced to I32) to start picking off elements from the second 1D array.


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

If the first array is periodic, is there a way to account for the descending values as well (i.e. rising and falling slope) when using the threshold palette?

0 Kudos
Message 6 of 9
(3,751 Views)

Do you need to trigger on both slopes?  If so, yes there is. just negate the array and use an appropriate threshold for the negative going trigger.

 

You will want some hystresis between the thresholds to account for noise  brb


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

Both slopes with hysterisis

Capture.PNG

 

Note: the difference between Samples in acquisition and Samples to capture after trigger is now your "Retrigger Blanking period"  We could ajdust that by the pseudo code

If "Leftovers" >0

N Samples per ch = Leftovers +Retrigger Blanking Period

Else 

 N Samples per ch = Retrigger Blanking Period + Samples to capture

 

And then use Retrigger Blanking Period + Samples to capture as the samples to acquire input into DAQmx Timing.vi


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

As a matter of fact that was such a good idea

Capture.PNG

 

Any more "Scope Creep" or have I met spec yet?


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