LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Measure the height of an square pulse

I'd like to measure the height of an square pulse. The pulse is 10 mus broad and betwean 0V and 4V high. The occurence of the pulse is random, so the application must be triggerd.
I searched already the ni page and forum for matching solutions, but haven't found any so far.

I'm using a PCI-6115 DAQ-card.
0 Kudos
Message 1 of 23
(3,788 Views)
I would recommend doing continuous, double-buffered acquisition. Examine each "chunk" of data to see if a pulse is present. If so, measure its amplitude and report it. Rinse. Repeat.

By the way, the 0 V pulse will be extra hard to find. 🙂

If you'd like a custom solution made up for you, hire an Alliance Member like us. We do this stuff every day.

Daniel L. Press
PrimeTest Corp.
www.primetest.com
0 Kudos
Message 2 of 23
(3,788 Views)
If you have a separate TTL digital pulse to use as a trigger, then set up your DAQ operation for external trigger (from this separate pulse), and sample for 10 mSec, at a rate to ensure you get at least 2 samples while the pulse is high. Then pick out the peak from your sampled data.

If you can't get a trigger pulse, you'll have to use continuous acquisition at a 200 Hz rate. Have a loop reading the data and searching for two or three consecutive non-baseline readings. Although I agree, you'll have real problems searching for a zero-volt amplitude pulse.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 3 of 23
(3,788 Views)
The double-buffered aquisition is a good idea. Thanks, I never thought about something like that.
But I have to apologize also! I forgot to post one little pieace of information: the pulse rate can be up to 10e4 per second. This makes the search for pulses very complicated. It was my first abroach to this problem, but I came in the vincinity of 10e4 analysis per second.
Is it even possible with a normal desktop PC or do I need further solutions like LabView RealTime ?

Sorry, for not posting this in the first mail! You know, it was one of those days ...

Thanks for your answer!

Stephan Klumpp
0 Kudos
Message 4 of 23
(3,788 Views)
10e4 = 10 x 10^4 = 10 x 10,000 = 100000 per second.

I interpreted your first post to say the pulses were 10 mSec wide. (10 mus = ???) Obviously that can't be.

Even at 10 MICRO seconds wide, if you have them at 100000 per second, you don't have a pulse, you have a continuous level.

Please clarify your specs.

Do you need to do this continuously, or can you record a batch of data and then process it to find the pulses?
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 5 of 23
(3,788 Views)
I meant with 10e4 = 10,000.
So, I have ca. 10,000 pulses per second. It is the highest value of pulses in extreme circumstances. Usually there are only 1,000 pulses per second in order of magnitude. The truth somewhat betwean 1,000 and 10,000. It depends on the performed measurement.
So, in the "worst" case I have to analyse 10^4 pulses per second as order of magnitude.

The measurement has to be continuous for 5s. But I have approximately 2s more for the analysis. So all counts of one measurement must be analysed after ca. 7s!

Thank you for your answer!

Stephan Klumpp
0 Kudos
Message 6 of 23
(3,788 Views)
10e4 and 10^4 are NOT the same thing.
You wouldn't think that 1.23e4 and 1.23^4 are the same thing, would you?
10e4 = 10 x 10^4 = 100,000
1e4 = 1 x 10^4 = 10,000

If you want to catch a 10 MicroSecond pulse, that would suggest a sampling rate of 100 kHz, bare minimum.
For 5 seconds, that's 5 x 100k = 5 million samples = 10 million bytes (assuming a single channel, recording as I16).

Depending on CPU speed, and RAM available, you could try the brute-force approach: record 5 seconds of data, then loop thru it and pick out the pulses.

I would suggest a trial:
1... Generate a 5-million sample array of I16 zeroes.
2... Change a few of the samples to +1000 (or something)
--- Now you have some phony data to play with.
3... Record the current millisecond timer value (T0).
4... Loop through the samples: If sample(I) > threshold and sample (I-1) is not (use a boolean shift reg.), then declare a pulse to exist at sample I. Append I to the array of indexes you're keeping.
5... When the loop is done, record the current millisecond timer value again (T1).
6... Subtract T1-T0 to get elapsed time. If it's greater than 2000 mSec, you can't use this approach.
7... Compare the results (indexes of peaks) to the peaks you put in (step 2). They should be the same.

If you can use this approach, it is the simplest to program.

Otherwise, you will have to use a double-buffered approach:
1... Define a CHUNK size of say, 2048 samples.
2... Set up a continuous DAQ operation to use a buffer of 2 * CHUNK samples.
3... Keep checking the DAQ backlog until the backlog is CHUNK or greater.
4... Read CHUNK samples from the buffer.
5... Search the chunk for pulses, append indexes to your results array.

--- Don't bother to read every sample in volts - too time-consuming - read it in binary (I16). Convert the peaks to volts afterward, if needed.

--- You need a threshold to distinguish a '1' level from a '0' level. The '0' level won't be 0.0000 volts, there will be some noise.

--- You might be able to measure the noise during the 2-sec down time, and establish your threshold that way.

--- The seconds approach assumes that the CPU is fast enough to process a chunk in less time than it takes to acquire one. If not, you're out of luck.

--- You don't want the chunk to be too small, as the overhead of calling the DAQ READ will swamp the processing time.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 7 of 23
(3,788 Views)
This is a good exchange of thoughts here, let me throw in something different.

If the frequency is constant (maybe not required?) and you measure the duty cycle (using counters) and then take the continuous double buffered info suggested by Dan and run that through the RMS function, you can back compute the amplitude.

For a rectangular pulse, the RMS value is

Amplitude X Duty_Cycle

where: Duty_Cycle is expressed in %.

In your original Q you siad "square pulse". A square pulse is usually a 50% duty cycle pulse, so...

1/2 X RMS is amplitude.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 8 of 23
(3,788 Views)
This approach also requires you be able measure the duty cycle using counters. If the signal cannot drive counters, it will have to be conditioned to do so.

In that case, it even measure the 0V pulse.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 9 of 23
(3,788 Views)
CORRECTION: 5 x 100k is 500 k samples, not 5 meg.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 10 of 23
(3,788 Views)