From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

How to sample a data input waveform with a trigger input waveform

Hi,

 

I am using the NI USB-5132 digitizer to receive two inputs: one is an analog data waveform and one is a digital trigger waveform.

 

Is there a way to generate a third waveform/array of data that corresponds to the data waveform being sampled only once per rising edge of the trigger input?

 

-Thanks

0 Kudos
Message 1 of 5
(2,475 Views)

Ddetone,

 

I'm assuming that you're reading in the analog data waveform in to channel 0, and the digital trigger waveform (which you're triggering off of?) in to the PFI1 line?

 

How are you configuring the acquisition and saving the waveform data that you are reading? There should be a way to split up the data or correlate what you are reading in, but I am a little confused as to your end goal. Are you trying to read in the full data set and then only pull part of the acquired information out to make a different array of data in LabVIEW? So you are trying to post-process the acquired data from the analog waveform in channel 0 in order to generate the data for a different waveform in LabVIEW? Is this correct?

Timothy S.
Senior Technical Support Engineer
0 Kudos
Message 2 of 5
(2,450 Views)

Timothy,

 

First of all thanks for the reply, I've been really busy this last week and haven't been able to reply.

 

Right now I have my data signal on channel 0 of the NI USB-5138, and I have the trigger on channel 1.  I have attached two corrections of how the signals look coming in (one is zoomed out, one is zoomed in, trigger is the red one the zoomed in one).  The trigger signal has 128 square pulses per scan that correspond to the time that I would like to sample 128 different high values for the data input.  I also have a 3rd input which has a falling edge for the start of each scan. As you can see in the zoomed out waveform graph, the data input consists of consecutive scans of data. 

 

My end goal would be to process the data so that I have 128 different arrays of 10-20 data points (each data point represents a different scan), with each of the 128-array corresponding to a different element in the 128-long scan, and how it has changed over time.  So for example, if the data at array location 3 changes from 0 V at scan t0 to 2.5 V at scan t1, then back down to 0 V at scan t2, then I would like to have an array that looks like:

 

Array of data for location[3]

Time:         t0    t1     t2

Voltage:     0     2.5   0

 

My biggest challege has been setting up these arrays.  Would it be best to capture 10-20 scans using the 'Acquire N Samples', and then do post processing?  I also experimented with the PtbyPt VIs, which seem interesting because I would like to do as much of my work in real time as possible, but I'm not too familiar with these or with Labview.

 

Any help would be much appreciated.

 

-Ddetone

 

 

 

Download All
0 Kudos
Message 3 of 5
(2,442 Views)

Typo:  I have attached two **attachments**

0 Kudos
Message 4 of 5
(2,439 Views)

There are two different ways we could look at this. The first would be to use a Multi Record acquisition with NI-SCOPE to generate separate records of the lengths you require for each trigger. This would be using the ni Scope Multi Fetch.VI, and there is an example showing this in the example finder (Help >> Find Examples) under Hardware Input and Output>> Modular Instruments>> NI-SCOPE (High-Speed Digitizers)>> Features>> niScope EX Multi Record

There are several options for the returned data type with this function, so I'd recommend to have a look, as it is likely the easiest way to get where you need to go.

 

The other methodology would be to so as you were suggesting, which would be to acquire finite sets of data and then do post-processing. To keep that as streamlined processing the arrays as possible, you would most likely want to use a Producer/Consumer architecture to process the data in the consumer loop while it is being acquired by the producer. There is also a template for this design (New >> From Template >> Frameworks >> Design Patterns >> Producer/Consumer Pattern (Data)).

Timothy S.
Senior Technical Support Engineer
0 Kudos
Message 5 of 5
(2,414 Views)