Measure Pulse Width and Period Statistics

Hello,
I'm trying to solve what should be a very simple problem. I would like to measure common characteristics of a binary analog voltage input, pulse width and period. The canned pulse width/duty cycle/period VIs and express VIs use a histogram or peak to peak method on a set buffer size of data and produce one output. I would like to measure these signal characteristics over a long period of time and collect statistics on pulse width and period data (max, min, median, mean, standard deviation, etc.) to indirectly measure the eccentricity of a system. Although I am relatively inexperienced in LabView scraping off a considerable bit of rust, I did not think this task would present a challenge, but I have been stumbling around for a couple of days trying to create an array of output parameters such as pulse width so that I may calculate the statistics on all measurements.
If anyone can step me through some of the thought process to a solution or show me how to format data collection so that this can be done, I would very much appreciate the help.
Thanks,
Evan
Attachments:
Example.jpg ‏194 KB

Hi Gena,
I am assuming you are using the DAQmx drivers in LabVIEW for your
PCI-6014.  Avoiding a While loop may be difficult if you need to
perform this measurement many times and you might not know when the
signal is going to begin.  Without a While loop, you'll have to
set up your timeout period long enough so the pulses will begin before
your VI stops.
With this in mind, you may want to look at some of the shipping
examples with the DAQmx driver.  You can find these in LabVIEW's
Help menu by going to Find Examples.  For measuring the pulse
width, browse the folders in the Example finder by going to Hardware
Input and Output>>DAQmx>>Counter Measurements>>Period
or Pulse Width.  In this folder, there is the Meas Pulse Width.vi,
which measures the pulse width once and stops.  You should be able
to take the pulse width measurement you get from here and check to see
if it's in your range, then output a pulse on the other counter if it
is in the range.  The pulse output examples can be found in
Hardware Input and Output>>DAQmx>>Generating Digital
Pulses>>Gen Dig Pulse.vi.
Thaison V
Applications Engineer
National Instruments

Similar Messages

  • Measure pulse width and generate pulse depends on the width

    Hi,
    i have a serias of pulses ... 600 micro,30 micro,30 micro (around 10 times) ........ nothing for 1 mili second ..
    so i need to generate a pulse after the first pulse arrives ... (its width around 600microSecond)
    1. use the first counter to measure the pulses ...
    2. if arrived pulse ... 500microSecond<the pulse width<700microSeconds .... then generate pulse with second timer ....
    the problem is that i dont want to use the while loop inside the labview ...
    can i programm the counters to make the width calculation and if the width is bigger to generate trigger to the second counter .... ?
    the hardware is 6014 sample card ....
    thanks
    gena
    (see attached)
    Attachments:
    F0087TEK.JPG ‏27 KB

    Hi Gena,
    I am assuming you are using the DAQmx drivers in LabVIEW for your
    PCI-6014.  Avoiding a While loop may be difficult if you need to
    perform this measurement many times and you might not know when the
    signal is going to begin.  Without a While loop, you'll have to
    set up your timeout period long enough so the pulses will begin before
    your VI stops.
    With this in mind, you may want to look at some of the shipping
    examples with the DAQmx driver.  You can find these in LabVIEW's
    Help menu by going to Find Examples.  For measuring the pulse
    width, browse the folders in the Example finder by going to Hardware
    Input and Output>>DAQmx>>Counter Measurements>>Period
    or Pulse Width.  In this folder, there is the Meas Pulse Width.vi,
    which measures the pulse width once and stops.  You should be able
    to take the pulse width measurement you get from here and check to see
    if it's in your range, then output a pulse on the other counter if it
    is in the range.  The pulse output examples can be found in
    Hardware Input and Output>>DAQmx>>Generating Digital
    Pulses>>Gen Dig Pulse.vi.
    Thaison V
    Applications Engineer
    National Instruments

  • Samples Not Acquired on NI 660x or NI 6624 Devices When using pulse width, semi-period or two-edge separation buffered measurements with the NI 660x and NI 6624 on counters 0 and 1, some samples may not be acquired under certain circumstances.

    In the DAQmx 9.4 Readme the following is stated:
    Samples Not Acquired on NI 660x or NI 6624 Devices When using pulse width, semi-period or two-edge separation buffered measurements with the NI 660x and NI 6624 on counters 0 and 1, some samples may not be acquired under certain circumstances.
    Could anyone elaborate on this? I am particularly interested in knowing under what circumstances this problem arises for the 6602 PCI devices.
    How should I understand 'NI 660x and NI 6624 on counters 0 and 1'. Is it only a problem on counter 0 and 1 for the 660x or does this only apply for the 6624 devices.
    /mola 

    Are there any NI Product Support Engineers out there who has an answer to this question and who are willing to share it with me?

  • Measuring puls width and time of 5 signals

    Hello,
    I have 5 signal lines that generate different pulses in time. I need to measure the pulse width on every line but also the exact time when the pulse occurs on each line.
    I have a PCI-6602 that I can use for this.
    Measuring the pulse width is not that difficult. I wanted to use a buffered pulse width measurement using 5 of the counters of my PCI-6602.
    But I do not know how I can also get the exact time for these 5 channels ???
    Any ideas how I can accomplish this with my PCI-6602?
    Note: I do not need to use the maximum source frequency for my counters. Measuring the pulses with a timebase of 1Mhz is enough. (maybe even 100 kHz but I need to do some more experiments to be sure).
    Thanks in advance for all your help!

    Only have time to outline some suggestions:
    1. Choose 1 of your counters to generate your timebase to make it easy to experiment with timebases like 1 MHz that aren't directly available on the board.  The other measurement counters should be configured to use it as their Timebase.Source signal (can be found in the DAQmx Timing property node.)
    2. I assume you want the 5 measurements to start at the same time=0 point, right?  You should configure all 5 to use the same signal as a digital "Arm Start" trigger.  In LabVIEW, this can be found in the drop-down menu for the DAQmx Trigger property node.   I would typically use PFI0 as the trigger signal because this maps to the same pin that I can control via software as digital port0/line0.  Thus, no screwdriver work for wiring a signal.
    3. If you're buffering 5 measurements, you'll need to configure at least 2 of the tasks to operate in interrupt mode because the board only supports 3 DMA channels.  This is yet another DAQmx property node setting.
    4. There, now that the prelims are out of the way, here's how to get both pulse widths and pulse start times.  It's gonna take a bit of work in software though.
       Configure the counters for semi-period measurement.  This will cause the tasks to buffer up arrays with alternating values representing high times and low times of the incoming signals.  You should be careful and always read even #'s of samples from the buffer, never odd #'s.  You'll also need to configure so that you can predict which comes first -- high or low time.
      The high times will be your pulse widths, and the cumulative historical sum of *all* the semi-periods up until that high time will be your timestamp.
    5.  Further description for handling 1 such task.  Create a while loop for reading values from the task.  Initialize a shift register to a count of 0 to hold your historical cumulative time.  (Note: depending on your duration and resolution, you may need to make this a double rather than an integer.)   Inside the loop, read an even # of samples from the task, say, 1000.   Pass the 1D array into the Reshape Array function to make it 500 rows x 2 columns.   Pass that 2D array into a For loop using auto-indexing.  Also pass in the value from your outer loop's left-side shift register into an inner loop shift register.  The inner loop will index out 1 row at a time.  The pulse width will be either index 0 or index 1, depending on your config settings.  Index it out and pass it out to the inner loop boundary with auto-indexing.  If your pulse width is index 0, the left-side shift register represents the timestamp for the beginning of that pulse.  Pass it out to the inner loop with auto-indexing as well.  (If pulse width is index 1, you may first want to add the duration of index 0 to the cumulative time.)  Finally, add the sum of indices 0 and 1 to the left-side shift register and pass it out to the right-side shift register.  Pass this shift register out to the outer loop shift register.  Pass the 2 arrays of data (pulse widths and timestamps) out to your main app via queue or something.
    That's all the time I've got right now.  I realize the info is packed kinda dense, but if you do some further searching on the terms I've brought up, you can hopefully figure out a good share of it.  Once you've got it pretty close, post back and I can try to suggest some tweaks.
    -Kevin P. 

  • Measure pulse width of signals generated by DAQ

    Eventually, I would like to:
        Start a counter pulse width measurement and analog out at the same instant.
        Stop the pulse width measurement with an external digital signal.
    My current plan is to use a digital out on the DAQ to go to a digital input and the counter start input.  The digital input will be a start trigger for the analog output.  This works, except for the counter.
    While trying to implement this, I tried a simpler test of just generating a digital pulse with the DAQ and wiring that to the counter inputs.  That doesn't work, even though it looks fine on an oscilloscope.  Then, without changing the software at all, I connect a function generator to my  counter inputs, and it measures pulse widths flawlessly.
    I'm actually implementing this with a Python wrapper around the DAQmx C API, but I recreated it in LabVIEW, and it behaves the same.  VI attached.  I have the latest DAQmx drivers.
    Attachments:
    meas_pulse_width_simple.vi ‏32 KB
    screenshot.png ‏99 KB

    ColeTrain wrote:
    apaulsen,
    Just a
    friendly heads up, but this is more of a DAQ post and you will
    generally get more replies to these types of questions by posting in
    the proper forum.
    That being said, try taking a look at
    the Example Finder and look under the DAQmx examples at
    synchronization/multifunction as this would be a good place to start
    working on what you're trying to wind up doing down the road. 
    I am actually the OP.  apaulson is my coworker, and he was logged in to the forums on the workstation from which I posted.
    I
    realized that it ended up in the LabVIEW forum, so I reposted on the
    DAQ forum:
    http://forums.ni.com/ni/board/message?board.id=40&thread.id=7185. 
    I understand why there is a search-to-post policy, but it's rather
    unintuitive and clunky, and I got confused.  IMHO, ubuntuforums.com
    does this the right way and automatically searches before you submit
    your post.
     Anyway, I figured it out.  See the other post for solution.

  • Can counter measure pulse width difference between two signals

    I am interested in determining the high pulse width time that two signals have when they are in various phases between eachother.

    Why don't you try one of the pulse width examples. I don't know what ADE you are using, but you can search for examples (http://www.ni.com/devzone/dev_exchange/ex_search.htm) with the key words "+pulse +width" and find several examples in different languages. This will measure the pulse width of one signal, but you can program most of the counters to do multiple tasks at the same time. Just copy the code twice and change the counter number to program counter 2 as well. If you want the ORed pulse width time, I would recommend adding a OR gate to your circuit and then feeding that into a counter.
    I hope this helps.
    Joshua

  • I am having data i want to measure pulse width without using hardware and tell me how to start and stop soft timer using labview

    soft pulse width measurement

    If you are creating a pulse in software somehow, then you can use Pulse Measurements.vi that's on the Analyze>Waveform Measurements palette. This will require that the input is of the waveform data type with signal and timing information. There's several timing functions on the time & Dialog palette that you could probably use. Check out Tick Count and Elapsed Time. If you could provide more details on what exactly you need to do, we could provide more help.

  • Measure pulse width with 4 counter simultaneously

    Hello,
    I am using NI PCI-6601 measure the pulse width with 4 counter simultaneously, due to only a DMA channel on this card so I selected interrupt data transfer mode to read data from PCI bus for 4 counters, but it working only for few seconds then a error message prompted:
    Error -200141 occurred at DAQmx Read (Counter 1D DBL 1Chan NSamp).vi
    Measurements: Data was overwritten before it could be read by the system.......(See attached picture: TestUI and Error MSG.bmp)
    I know the problem caused due to system is unable to read back data from PCI6601's memory as fast as they card countered. My quesition is:
    1. The timebase is 20Mhz(Sample rate), how to change the sample rate slower (like 100Khz) ?
    2. Any good solutions can meet my requrement?
    Attached is my source code, Test.vi is the main VI.
    Thanks for your help.
    Steven
    Attachments:
    Test.zip ‏557 KB

    What's more, you could include four channels in one task, so you don't need to build four task!
    Attachments:
    4 counters in one task.png ‏719 KB

  • Looking for VI to measure pulse-width on a waveform

    does anyone know of a VI to measure the pulse width of a pulse trace in a waveform?

    The examples to look for would be located under the DAQ >> Counters examples, and you would probably be looking for anything using the DAQ-STC chip (which is the counter chip on our E-Series board). Advanced examples that are in addition to the shipping examples can be found by searching the website as well.
    Jim Cahow
    Applications Engineer
    National Instruments

  • How to generate a pulse train with different pulse width and delay?

    How to generate a triggered pulse train with different pulse width. for example, after each trigger signal, let's say 2 ms, then the counter output a pulse with pulsewidth of 1 ms, and then after 3 ms delay after the first pulse, the second pulse was generated with a pulse width of 4 ms.  Next cycle when the trigger signal comes, the same two pulses will be generated and so on. Is it possible to achieve this by using 6601 counter card? and if yes, how to achieve this? Thanks!

    Unfortunately you can not create a hardware timed pulse train with different widths on each pulse from a counter. Whilst it can be changed on the fly using software, since you require a hardware triggered signal getting the software involved will not give a huge amount of accuracy when the pulse will actually change.
    So in short you can't use your 6601 card (or a counter timer) to achieve this
    There are three possible Alternative solutions
    1 You could use a high speed digital IO device such as the (6533/34) to generate your variable signal which would require setting up the pulse train as a series of states based around the burst transmission mode where the clock would give you your specific timing.
    2 A timed analogy output (for example on a MIO card with a clock (PCI-6220 / 62xx), i.e. Not the 6704 style static analogy output cards)
    3 A high speed digital waveform card such as the (, 656x , 655x, 654x, 6534, 6533 (http://www.ni.com/modularinstruments/find_right.ht​m) ) this could then be scripted to work with your triggering and also there is a digital waveform editor which will enable you to set up the pattern you wish to generate (http://sine.ni.com/nips/cds/view/p/lang/en/nid/135​55) 
    Hope that helps
    Tim Matthews
    NI (UK)

  • NI 6602 buffered pulse width and buffered period measurement with 2 counters synchronized during a defined time "

    it is OK for 2 counters if I count a defined number but I would like the values during a time for example 10 s .It seems that the acquisition is not complete.Is a problem of circular buffer, time out error .....?

    Hi:
    I am assuming that you are using 2 counters to generate a finite pulse train for 10 seconds and are using this pulse train to gate the other counter. If this is your setup, you should not have a problem in retrieving the correct number of readings.
    You can monitor to the backlog and number read by wiring indicators to Read Buffer VI. Please also look at the Count Buffered Edges (DAQ-TIO).vi examples to learn how you can correctly set up a buffered counter acquisition.
    To open up the example, click on Help -> Find Examples -> Hardware Input & Output -> Traditional DAQ -> Counter -> NI-TIO.
    Regards,
    Bharat Sandhu
    Applications Engineer
    National Instruments
    Penny

  • NI 6602 buffered pulse width and buffered period measurement with 2 counters synchronized

    I modify the example buffered event counting with 8 counters for use with 2.I obtain error 10600 or 10455 and never the waited values.Can you give me a VI example . Thank you for your help

    What changes did you make to the VI? If you attached the altered example I could take a look at it. The example program for using 8 counters performs some configuration that you won't need for just two counters. For instance, if you just want to use counters 0 and 1, you won't need to perform pad synchronization.
    I've altered the program to use with two counters and attached it to this response. Hopefully this will work for you.
    Regards,
    Todd D.
    NI Applications Engineer
    Attachments:
    Buffered_Event_Counting_(2).vi ‏126 KB

  • Video pulse(width and count) train measurements

    We need to measure the sync pulse's width in a video signal to first determine the occurrence of the vertical sync pulse in each field, and then we need to count the successive horizontal sync pulse edges in order to arrive at a specific video line.
    Are there better suggestions on how to arrive at a particular video line in the video signal?

    Do you want to do image acqusition and acquire the image from your camera for display/analysis purposes or do you just want to measure the distances between pulses. If you do want to acquire your images from the camera, you won't need to worry about measuring the distances, the driver will take care of all these details and just return the pixel values to you that occured during the active time of VSYNC and HSYNC on the edge of the clock.
    If you do want to measure the timing of your HSYNC/VSYNC/pixel clock, etc. I would recommend a 6602 counter timer board. The DAQ people can give you more info on this.
    Hope this helps,
    Brad Buchanan
    Image Acquisition
    National Instruments

  • How do I measure pulse width in VeriStand 2010?

    I'm using an NI PXI-6229 M Series DAQ.
    I the channel set up in System Explorer and I have my input signal routed to the Gate of Counter 0.  When I deploy and open the Workspace the measurement says 0 seconds although an oscilloscope shows a 7ms square wave at the terminal.
    I think the problem may be that I don't have a timebase applied to the Source of Counter 0.  How do I put an internal timebase on the Source?  I would prefer to do so without changing any VIs and I definitely don't want to add an external frequency generator to my setup.

    I think that the gate terminal cannot be used in that case. You might want to try to connect the external signal to the input terminal of the counter.
    Once you have rewired the external connection you will notice, that NI VeriStand might not update the frequency that often. NI VeriStand doesn't measure the frequency/period by using a frequency task. We have used a simple edge counting task that takes the upper and lower limit of the frequency to determine the update rate of the frequency value. The more accuarate the settings are, the higher is the update rate. In order to get a feasible update rate, increment the lower limit to a value that will never be below the real minimum frequency of the external signal and set the upper value to the maximum expected frequency.
    Thanks,
    Tom
    http://www.newgistics.com

  • Measure pulse width cont - failure in example? NI-DAQmx

    Hello!
    I tried the "PulseWidth-Buff-SampClk-Cont.c"-Example. I got the following error:
    DAQmx Error: Invalid timing type for this channel.
    Property: DAQmx_SampTimingType
    You Have Requested: DAQmx_Val_SampClk
    You Can Select: DAQmx_Val_Implicit, DAQmx_Val_OnDemand
    Task Name: _unnamedTask<0>
    Status Code: -200300
    Here is the Example-Code:
    #include <stdio.h>
    #include <NIDAQmx.h>
    #define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else
    int main(void)
        int         error=0;
        TaskHandle  taskHandle=0;
        int32       read;
        float64     data[1000];
        char        errBuff[2048]={'\0'};
        // DAQmx Configure Code
        DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
        DAQmxErrChk (DAQmxCreateCIPulseWidthChan(taskHandle,"Dev1/ctr0","",0.000000100,0.838860750,DAQmx_Val_Seconds,DAQmx_Val_Rising,""));
        DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"/Dev1/PFI0",1000.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000));
        //DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"/dev1/PFI13",1.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000));
        //DAQmxErrChk (DAQmxCfgImplicitTiming(taskHandle,DAQmx_Val_ContSamps,1000));
        // DAQmx Start Code
        DAQmxErrChk (DAQmxStartTask(taskHandle));
        printf("Continuously reading. Press Ctrl+C to interrupt\n");
        while( 1 ) {
            // DAQmx Read Code
            DAQmxErrChk (DAQmxReadCounterF64(taskHandle,1000,20.0,data,1000,&read,0));
            printf("Acquired %d samples\n",read);
            fflush(stdout);
    Error:
        if( DAQmxFailed(error) )
            DAQmxGetExtendedErrorInfo(errBuff,2048);
        if( taskHandle!=0 ) {
            // DAQmx Stop Code
            DAQmxStopTask(taskHandle);
            DAQmxClearTask(taskHandle);
        if( DAQmxFailed(error) )
            printf("DAQmx Error: %s\n",errBuff);
        printf("End of program, press Enter key to quit\n");
        getchar();
        return 0;
    What could i do?
    Thanks
    Andreas

    The help says this:
    Sets only the number of samples to acquire or generate without specifying timing. Typically, you should use this function when the task does not require sample timing, such as tasks that use counters for buffered frequency measurement, buffered period measurement, or pulse train generation.
    So this line is only needed for specific applications. The counter has no sampleclock, like the analog input or the analog output, so you can not use this, but have to use implicit timing instead.
    Hope this helps!
    André

Maybe you are looking for

  • Reading Multiple Tables with VB

    I'm attempting to retrieve records from multiple tables base on info returned from the previous call. This code fails on the second call to " IF RFC_Read_TableTJ.Call = True" also if I comment out "IF RFC_Read_TableTJ.Call = True" is creates the next

  • Horizontal scroll in TreeTable

    Hi everybody Is there a possiblity to have a horizontal scrollbar in a JTreeTable? I ran the program from java.sun.com and a personal one, and both never display a horizontal scrollbar. If you program it as always displayed, it is not scrollable anyw

  • Stupid 3 hour time limit...

    I've been using Adobe Audition 1.5 for years, with perfect success, but last week i decided to install the CS5 suite. Fine. Yesterday, I go to look for Audition, and it's gone...like there was some conflict. My system (Windows 7) wouldn't even let me

  • WRT1900AC integration with Linksys Hosted Router Management?

    I recently purchased a new WRT1900AC.  When I first started it up, I was prompted to set things up with a preconfigured Router Name and network Names, did so, and then quickly realized that I had made a mistake since everything on the wired portion o

  • Multiple Cache server  Connection To content server

    Dear all i have installed content server 6.40 on win 2003 server, now we have 2 remote location & i want to connect those location to my local content server through Cache anybody have any Idea regarding how to do this?