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.

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
Blog for (mostly LabVIEW) programmers: Tips And Tricks

Similar Messages

  • How can I measure the full width half max pulse-width of a gaussian function?

    Hi I am measuring a laser pulse using a Tektronix scope and feeding that data into my labview (v 7.1) based data system on a Mac OS X computer. I want to measure the full width pulse at half the maximum peak. The included measurement VIs that come with labview and the tek scope dont seem to do the job (even though the scope itself can do the measurement). I've attached my example VI. If anyone has any suggestions that would be great.
    Thanks,
    Paul
    Attachments:
    test scope.vi ‏255 KB

    If you can display a trace on the screen, you can get the full width at half maximum. LabVIEW gives you several options:
    Use the Pulse Parameters VI to determine the width directly. This will be a width based solely on the data with no assumption as to an underlying model.
    Use the Levenberg Marquardt VI to fit a gaussian to your curve, then calculate the full width at half maximum from the coefficients. Levenberg Marquardt is a least-squares/gaussian algorithm, so is somewhat noise sensitive.
    Use one of the minimizer functions (e.g. Downhill Simplex) to construct your own fit using a different assumed error distribution. If you are unsure how to do this, check out a copy of Numerical Recipes in C by Press et. al. and read the section on data fitting.
    Do your own data based calculation. Find the peak with Peak Detector. This will give you the magnitude, but you may want to verify it with a polynomial fit (parabola is usually good enough) across the top of the peak to avoid noise problems. Then find the positions of the half-maxima on either side of the peak. The Interpolate 1D Array will probably prove useful for this.
    Choose your method depending on your pain threshold and how accurate and robust you need the result to be. Good luck!
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • How to measure the baseline of a noisy, pulsed signal

    Hi
    I am measuring the torque exerted by a large motor on a shaft using a load cell and lever arm. The shaft runs at approx 150 rpm. I have attached a drawing that shows the output I get. This is a test rig.
    I have written some code that measures the maximum peak out of a group of approx 5 peaks and writes this to a shift register. This gives me an idea of the maximum torque "spike".
    I also wish to measure the baseline torque (due to the bearings in the machine). Even when highly filtered (my noise filter is set to 49Hz) the signal exhibits this noise which is probably due to vibration in the system. The signal is zeroed when the motor is not running.
    Does anyone have an ideas on how to measure the "baseline" torque? The large spike in torque prevents me from doing a running average. Can anyone think of a way of averaging just the noisy part of the signal to get an average value? I aim to to subtract the average baseline torque from the peak value to get an idea of the torque due to the event which causes
    the spike.
    Any help would be greatly appreciated.
    Many thanks.
    Attachments:
    drawing of torque signal.gif ‏26 KB

    Thanks for the reply. I understand what you are saying. However, I might have to modify my method for measuring the peaks if I choose to implement your idea. I have taken a screenshot of my "peak finder" code and attached it.
    Bascially, the reset terminal is wired to a timer which outputs a pulse every few seconds. This resets the vi (a standard NI one I think) and sets the peak magnitude back to zero. This way, I am windowing the signal and measuring the maximum peak in every window. This is what I need to do.
    So I could use a logical filter to feed data to the running average only if;
    the amplitude of the signal is less than a certain threshold
    and if the current value has similar low peaks either side of it
    How would you construct the code to delay the evaluation so that the values in front and behind of the current data point can be analysed?
    thanks again
    Attachments:
    peak_find_screenshot.jpg ‏45 KB

  • Wiring a SCB-68 to measure the frequency of a TTL pulse signal

    Sorry if this is a basic question but could someone please help me and tell me how to wire up a SCB-68 connector block (connected to a AT-MIO-16 DAQ board) so that I can measure the frequency count of a series TTL pulses (signal from photon counting). At the moment I don't understand how the PFI1-9 connections are related to the GPCTR0/GPTR1 counter connections on the block and how they're all realted to the source,gate and out 1-5 connections on the DAQ board.
    Ultimately I want to be able to put this measured frequency into a Labview program with a controllable gate period.
    Thanks in advance
    Nick

    You might want to search the Knowledge Base on the NI's Support Pages for "Cable Mapping for a 68 Pin Connector to a 50 Pin Connector". This should take you to a link that will explain the mapping of a 50way to 68way cable and subsequent lines you are looking for ( reference sub link 68F50M), I guess you have SH6850 cable connected from the AT-MIO16 card to the SCB-68.
    Please check out the information about the pin outs, that should help you work out which pins map to the counters, eg GPCTR0_source would be pin 37 on your SCB-68
    Regards
    Joe (NI)

  • How to measure the period of each consecutive pulse in a pulse train?

    Hello all,
       I am trying to measure every pulse period in a infinite pulse train. the pulse is actually from a encoder(360 pulse per rev) connected to a varing speed shaft. The mean speed is around 6000 rpm at the highest point, and it has periodic variation, this is why I want to measure the instantaneous speed.
       I tried to use A signal of encoder (360 pulse per rev) to connect to CI Period measurement terminal and read 360 sample at a time. but it seems more than half of pulse reading are missing, which looks like that the read vi need some time to finish the measurement of every pulse before it can handle next one, cause it miss some pulse.  The A signal I injected is around 10 KHz. Does my PCI-MIO-16E-4 or DAQ 6036 capable to handle this task?
    thanks
    Feilong

    Hi Conseils,
       Thanks for your reply. I took a look on that discussion thread and started to study the "continously semi period buffered measurement.vi". I set a signal generator which gives 7 pulses once you press its trigger button to verify if that code could pick up all the resault. The frequency is set to 3KHZ.
      I also modified that vi a little bit to explicitly set DMA transfer and changed it to finite sample mode with 6 samples at a vi run.
      The min T value I input was 0.000028 s and max is 0.00042 s, which gives a engine rpm range of 400 rpm to 6000 rpm at 360 pulse per rev.
      And I input 4 into "sample to read" control.
      When I run the vi, after have signal generator output pulses, there's error:
     Error -200278 occurred at DAQmx Read (Counter 1D DBL 1Chan NSamp).vi:1
     Possible reason(s):
    Attempted to read a sample beyond the final sample acquired. The acquisition has stopped, therefore the sample specified by the combination of position and offset will never be available.
    Specify a position and offset which selects a sample up to, but not beyond, the final sample acquired. The final sample acquired can be determined by querying the total samples acquired after an acquisition has stopped.
    Attempted to Read Sample: 6
    Property: RelativeTo Corresponding Value: Current Read Position
    Property: Offset Corresponding Value:
        It looks like the sampling procedure stops before the read.vi get enough (was 4 in this case) sample. But the sample I injected was 7 in total and the finite sample property was set to 6, which should satisfy the property of number of sample to read in read.vi.
        Could you please tell me where I am going wrong?
    Many Thanks
    Feilong

  • I want to measure the width of a single pulse on a line.

    Hi
    I want to measure the pulse width of a single pulse on a single line. the pulse width may be very low like micro seconds. Any answer plz ! kindly write soon....its urgent. I m ussing a 'Measure Pulse widh or Period VI' for this but his is not working for single pulse.
    Regards
    GNS

    You might try using the "Measure Pulse (DAQ-STC).vi" example located in
    ./Program Files/National Instruments/LabVIEW/examples/daq/counter/daq-stc.llb/*.
    Or if you're using a TIO board, try using the "Measure Pulse (NI-TIO).vi" example located in
    ./Program Files/National Instruments/LabVIEW/examples/daq/counter/ni-tio.llb/*.
    gus....

  • LabVIEW/SignalExpress: How can I automate measuring the time between two pulses?

    Hi everyone, bit of a newbie here so please bear with me.  
    I'm a student at a university conducting a muon decay experiment with an oscilloscope connected to some photomultipliers.  To summarize, if a muon enters the detector it will create a very small width pulse (a few ns).  Within a period of 10µs it may decay, creating a second pulse.  The oscilloscope triggers on the main pulse 5-15 times per second, and a decay event happens roughly 1-2 times per minute.  I am trying to collect 10 hours of data (roughly 1500-2000 decay events) and measure the time it takes for each decay.
    I've been able to set recording conditions in SignalExpress that starts recording on the first pulse and stops recording on the last.  The Tektronix TDS 1012 oscilloscope however feeds 2500 points of data from this snapshot into a text file (for use in excel or other software).  Even if I perfectly collected the data, I would have 100,000+ data points and it would be too much to handle.  I don't know how (or if it's possible) to reduce the sample size.
    To conclude, using Labview or SignalExpress, I would like to be able to have the software
    1.  Differentiate between the single pulse detections and double pulse decay events
    2.  Record only when two pulses appear on the oscilloscope
    3.  Measure the time between these two pulses and ONLY that to minimize the amount of data recorded.
    Any help would be GREATLY appreciated, thanks!

    Hi wdavis8,
    I am not that familiar with Tektronix, but there should be a place in the dialog that you go through when you create the action step to acquire date to specify a sampling rate. That would allow you to reduce the number of data points you are seeing, but may reduce the quality of the data.
    If it’s just a matter of that much data being hard to dig through when you have that many points, you could do some analysis on the data after the fact, and then create a new file with only the data you want to look at. For example, you could identify the peaks in the data, and based on the distance between them or the difference in magnitude, selectively write data to a new file.  
    Here is some information about peak detection in LabVIEW:
    http://www.ni.com/white-paper/3770/en/
    You could also do some downsampling on the data to get fewer data points:
    https://decibel.ni.com/content/docs/DOC-23952
    https://decibel.ni.com/content/docs/DOC-28976
    Those are just a few quick ideas. 
    Kelsey J
    Applications Engineer

  • Is it possible to measure the pulse height of 20 ns pulses at 100 Khz with Fpga?

    I would like to measure the pulse height of 20 ns width pulses at 100 Khz. The pulses arrive with a gating signal. I guess this would require a sampling speed of at least 500 MHz.
    Itai

    I agree with tbob if you are just trying to detect the pulse. If you want to measure the rise time ripple etc, then the 10 samples per pulse may not be fast enough. Nyquist talks about the highest freq component of your signal. For a 50MHz pulse the lowest freq component is 50MHz and the others are above (Check CRC handbook for fourier transforms).
    Discalimer: Anything and evrything that I say that is math related should be taken with grain of salt. I once tried to take the log of a negative number!
    Sanity Check Q:
    Can a FPGA sample faster than it can loop? I thought the top end loop rate fro a FPGA was 40MHz
    Oh well.... just trying to help!
    Ben
    Message Edited by Ben on 01-02-2008 01:03 PM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Help with measuring the frequency of a pulsing signal

    Hi,
    I am trying to use LabView to measure the flow from my ultrasonic flow meter. The meter sends a pulse for evey 10 litres of flow: I am picking up the signal in LabView without any trouble - it's basically a square wave that pulses at 10V and goes back down to 0V for the same duration.
    All I need to do is measure the frequency or period of the wave, but I have had no luck with any of the vi's. They seem to focus on the wave when it's either at 10V or at 0V and return the period as infinite or 0.
    I then attempted to program a sequence which returned true if the signal was =1 (the rising edge of the pulse), if true it would go to the next step, check again if =1 (falling edge), if true go to the third step and check if signal =1, and time that sequence, giving the period of the wave. Unfortunately this didn't work either.
    Any suggestions?
    Cheers,
    Liam

    Hi, I have the same problem - my LabView edition is Student so I don't think I can access them.
    Unfortunately the problem is still persisting. I have been working with someone who is quite experienced with LabView and he can't solve the problem either.
    There was some progress when I used the Trigger and Elapsed time .vi's to measure the time between rising edge pusles. Since the pulses were quite slow, by putting the period-to-flow conversion equation in, the flow could seen reducing to a minimum value as the elaspsed time increased to the full period. I have fitted new, more accuarate flow meters into he pipes which now send 100 pulses for each litre of flow. These flowmeters now pulse so quickly that it's impossible to see what the minimum flow value is to get the flow.
    If anyone knows of a way to select the maximum time value (i.e. the full length of the period of a square wave) that would be one solution to the problem. Any other suggestions on the best way to measure square waves would also be gratefully received.
    Thanks in advance
    Liam

  • How to measure the time a pulse is high for?

    I am using Pulse measure.vi to measure the output of a comparator. My comparator output feeds to an LED. The duty cycle is 50% so the LED just flashes on and off. I want to measure the time the output is high ('ON time') and I have been getting this by just multiplying the pulse width measure by the no. of pulses but I want to modify it to measure the 'ON time' of random signals with different duty cycles...
    The aim is that I am taking in a signal and need the LED to turn on when the signal 'ON time' reaches a certain specified time.
    But before I continue with the LED I am wondering how to add up the time the signal is high for?

    Hi PinkLady4218,
    You should be able to use one of the shipping examples to do what you need, please open LabVIEW and go to Help >> Find Examples.
    From the Example Finder please go to Hardware Input and Output >> DAQmx >> Counter Measurements >> Period or Pulse Width >> Meas Buffered Semi-Period-Continuous.vi
    You will then need to deinterleave the output array as it will show high time then low time then high time then ...
    You will need to confirm the order these values appear and then you can use a function from the arrays palette and use the function "Decimate 1D Array"
    Regards
    JamesC
    NIUK and Ireland
    It only takes a second to rate an answer

  • I want to transmit a square pulse through USB port, is it possible?? if not then what is the best way to do that, preferable is with serial then parallel, and its compatibility with vista,XP,and @))7 windows

    hi froends
    i want to transmit a square pulse using lab-view, please help how to do that, the preference  will be USB,SERIAL, Parallel ports, it it must be compatible with all the os versions, like 2007 windows, vista,XP and other.
    please help..................

    sanghi wrote:
    OK I WANT TO DRIVE A RELAY.
    SUGGEST SOMETHING 
    Calm down!
    People can't read your mind.  If you want help, repsect those who contribute their time for free to try to help you.
    Put yourself in our shoes.  If I tell you I want to build a rocket, what information would you give me?  You would need to know if it's for a hobby, something bigger, carries a payload, carries living organism, how far does it go, where does it land (if at all), etc...  
    First of all, we still don't know what you want to do with this relay.  Using a computer to generate is series of pulses is not usually the best way.  What is the frequency of the pulses that you want to transmit?  And why do you want to use a relay?  What are you driving?  Can the relay that you are using fast enough to follow the pulse train that you'll be sending?
    Provide information, ask questions politely and people will help you.

  • Increase the freq of square pulses generated by the counter

    I have program that outputs a finite train square pulses through a counter to run my step motor. I find that this program can genrate a sq pulse at a freq of 1080 Hz max. Is this a limitation of my program ( I have attached a copy of my program) or of my interface card (PCTIO-10, one of the older cards from NI) ? I use labview 5.0 on a windows NT , pentium MMX machine.
    Is there anything that I could do in my program to generate pulses at a higher rate ? I havent specified any of the low level parameters for the pulse config.vi in the program - could setting these values help in generating higher frequencies?
    thanks very much,
    Lalitha.
    Attachments:
    1d.vi ‏77 KB

    hi Tiano,
    you should be using the vi in the Search Exmaples->Data Acquisition->Counters->Finite Pulse Train.
    this is how you modify this vi to generate pulses at varying frequency.
    Set Device=1, Counter=1, Number of Pulses=100, Frequency Array=10, 100, 1000, 10000.
    [Place an array container on the front panel. Drop the Frequency control into the array. On the block diagram place a
    For loop around the whole program. Move the new array to the outside of the For loop. Wire the array to the edge of the for loop and then to the terminal that the Frequency control was wired to before. One
    the front panel, set the first four elements of the array to the values 10, 100, 1000, 10000.]
    I am attaching a copy of this mod
    ified vi for your ref.
    hope this helps,
    Lalitha.
    Attachments:
    fast2-vel_change.vi ‏156 KB

  • How to measure the frequency of a pulse being generated by a counter

    Hi,
    I am using labview 8.6 to generate 5 evenly spaced pulses for every 1 revolution of my shaft. However, I would also want to know the frequency of these pulses so I can determine the shaft speed. Since I am already generating the pulses using one of my counters, can I still tap into that or task another counter to measure the pulse frequency? If so, how? I have attached my code for generating the pulses and I am using an Ni 9401 module and an NI 9172 chassis. If someone can helo me modify the code to measure and tell me the pulse frequency as well, that would be really appreciated
    Attachments:
    autotrain2.vi ‏19 KB

    You'd probably get a more coherent answer if you didn't bounce around from thread to thread so much...
    How can I generate a pulse train from shaft encoder? (5/13)
    pulse train from encoder (5/15)
    how to measure rpm (5/20)
    How to measure rpm using shaft encoder and labview (5/23)
    This thread (also 5/23)
    I see you ignored my suggestion from the other thread--Kevin's solution is good too but using an encoder task offers more noise immunity (I think this is probably the cause of the problem you reported on the other thread).  You can fix it with digital filtering if you want to keep using a counter output instead of an encoder task.  Noise during transitions is pretty common for a quadrature encoder.
    A finite counter output task uses 2 counters on the 9172 (although you said 9174 earlier at one point--this wouldn't be the case on a 9174) so you wouldn't have one left to make your frequency measurement.  With the solution you have now, you can change to continuous to free up a counter if you don't care about outputing an exact number of rotation's worth of pulses (I'm not sure if you do or not--I didn't read through all of the various threads relating to this application to find out).
    For your actual question in this thread...  Have you tried running one of the frequency measurement examples?  From the code here I can't tell what you have tried (it just looks like a mangled version of the code Kevin gave to you in your other thread).
    Best Regards,
    John Passiak

  • Measure the Pulse duration by using NI PCI6250 counter module

    Hai All,
    For my application i need to measure the pulse duration from encoder signal.Encoder PPR is 1024. Maximum speed is 4500 rpm.Encoder signal is connected with NI PCI6250 card Counter input. If i configured my NI DAQ task as a Pulse duration measurement icant able to get prober pulse duration. Pulse duration some times reads as zero or near to zero and values also varies. I dont want average pulse duration. I need each pulse duration.Can any one help me to solve my problem?...
    Regards,
    Vijay.  

    Can any one Help me to solve the above problem
    Regards,
    Vijay

  • How to measure the pulse duration of a TTL signal using AI?

    Hi there.
    I would like to know how to measure the pulse duration of a TTL signal using an Analog input.
    These TTL signals comes from an ultrasonic sensor's output. The pulse width of the signal is
    proportional to the distance of the object the sensor detected.
    I have tried using the example "Measure Pulse Width.vi" which uses a counter to measure the
    pulse duration instead. It provides me with correct results.
    However, i will like to know how can i do it using the AI instead.
    I tried it by using the example "Acq&Graph Voltage-Int Clk.vi" which i modified by including a
    timing and transistion measurement vi. Pulse duration was selected as the output. A graph indicator was also added at the output of the pulse duration to monitor the incoming TTL signals.
    However, everytime the TTL signals was detected on the graph indicator, the numeric indicator always produce a "zero" reading.
    I have attached my vi for your reference.
    Can anybody advice me what i have done wrongly?
    Regard.
    Attachments:
    Acq&Graph Voltage-Int Clkv1.vi ‏190 KB

    Hi Paul,
    Today i tried using 2 different methods to read the pulse duration of my sensor signal.
    Both methods use "Acq&Graph Voltage-IntClk" vi as a guide.
    Method1:
    Add a filter vi(lowpass/bandpass) and a timing and transition measurements vi.
    Pulse duration is selected as the output. With some numeric conversion, a centimeter
    reading indicator was created. However, the reading always remains as "zero"
    Method2:
    Add a Mask and Limit Testing vi and a timing and transition measurements vi.
    By adjusting my upper and lower limits, i manage to "filter" a single pulse out from the actual signal.
    However, like the earlier case, the cm reading still remains at "zero"
    I have attached both the methods resulted waveforms for your reference.
    Are there anything that you can advice on?
    Regard.
    Attachments:
    Results_Waveforms.doc ‏141 KB

Maybe you are looking for

  • Command line parameters as args

    Hi, My program expects configuration as parameter. for ex java Myclass url myURL u myUser --p myPwd now, In case of loadjava, how do i pass these parameters as command line arguments on oracle db server??? Regards Praveen

  • Time Machine has Gone Nuts

    I hope somebody can help with this. I have an aluminum Macbook Pro with a 160 GB internal drive and an external Seagate 300 GB drive. There's about 50 GB of miscellaneous stuff on the external drive alongside a Time Machine backup -- in the same part

  • How to report problems??

    Hi This may be a dumb question, but how do I report problems with patches? I can't find any place on this site. Just to be on topic: I have a problem with gethostbyname function. I have installed the latest 8_recommended patch cluster, and the proble

  • -50 error: can't connect to server?

    I purchased music. Then my Internet service went down. When the service came back up, when I go to Advanced/Check for Purchases, it says it's trying to access my purchases, and then I get a -50 error that says it can't connect to the server. This has

  • Banshee + dbus problem

    I just switched from gnome to xfce and xmonad. Everything is wonderful but I've got an issue with banshee. It works, but it doesn't "connect" to dbus, and so I can't set my keybindings to it since if I try to execute something like "banshee-1 --previ