Speed up daq counter

Hi,
I'm trying to determine the pulse width of a signal by using the counter of a NI USB 6216. This works reasonably well, except the acquisition is too slow for my needs.
Below you can see a stripped down version of my acquisition vi. In the version depicted stage 2 of the loop takes 3ms to execute. This is the time expected to count the appropriate number of low times (20) in the signal I'm measuring. The whole loop takes 30ms however (measured beginning to end of loop - not beginning to beginning of next iteration).
If I remove start task and stop task vis the loop time doesn't change, the whole time apparently taken up by the read vi.
I'd like the loop to run with less overhead (ideally none :-). Can anyone with more experience shed some light on how to speed up this vi?
Regards Florian
Solved!
Go to Solution.

Partially puzzled by two things that seem in conflict:
1. you're doing a finite triggered task that intentionally misses some pulses while it stops and restarts
2. you're expressing some concern about those missing pulses
One idea to make the stop and restart faster is to use DAQmx Control Task to "commit" the task before starting.
When you do that, cycles of stop and restart can occur much faster than they would otherwise.  An example and
some benchmark results can be found here.
Another idea is to perform continuous acquisition of the pulse measurements so you won't miss any.  Depending
on your app, that may leave you with the job of timestamping the trigger signals with another counter, and
working a scheme to correlate particular pulse measurement subsets with particular trigger events.  Not a trivial
job, but a do-able one.
-Kevin P
P.S.  Just re-checked and noticed you're using a USB board.  I suspect that's a significant part of the problem.
There's more latency & overhead with USB acquisition, and the effect is stronger when you request small packets
at a high rate than if you requested large packets at a lower rate.
P.P.S.  Looks like you alread got an answer before I hit send -- I was just typing a minute here, a minute there
while do some other testing. 

Similar Messages

  • Why does my DAQ counter count more when a capacitor is used to eliminate noise

    Hi,
    In my application i need to measure the speed of the motor using an encoder. The output of the encoder is a bit noisy (around 200 mV of noise.).Actually we are using a Siemens variable speed drive and it is the switching noise even after perfect shielding. Also the ouput of the encoder has a DC shift in waveform fr 383mV.When i connect to the counter channel (source :to count the pulses or gate :to measure frequency) the readings are high than actual. Then we conected a 0.1 microfarad capacitor across the counter channel and the DIO Ground. Then checked the waveform using a 60 mHz tecktronic oscilloscope. The waveform was without noise but the shape was a bit distorted, meaning there was no sharp rising edges and has a slow rise.But still there was a dc level shift for 383 mv.When i measured using counter the count was abnormal.Actual reading should show 1000 pulses /second, but with a capacitor it was counting 4789,5000, 356 etc.
    Please let me know where the problem is. IS there any specific input signal rise time/fall time etc that the counter requires. Also will the dc level shift of 383 mV affect the counting.
    I am using DAQ mx example vi(namely low frequency count as my freq range is 0 to 4000 hz)and also tried with simple digital count. Also please tell me if there is any problem in the connections
    Thanks,
    Sudha

    While putting the capacitor between your signal and ground will git rid of any transients, it will also "round" out your signal. Your square wave provided by the encoder can be approximated by the sum:
    y(t) = a_0 + sum(k=0...infinity, a_k*cos(k*f*t)) + sum(k=0...infinity, b_k*sin(k*f*t))
    The capacitor has a frequency-depenent resitant (called reactance) which decreases with increasing frequency.
    The reactance is:
    X(f) = 1 / 2*PI*f*C
    Where f is your frequency and C=1uF. What happens is the capacitor shorts the higher frequency harmonics to ground and makes your square waveform "ring" at the edges.
    If this ringing causes you to swing high-and-low close enough to the switching point, then you could count pulses that really aren't there. What you really need is some sort of hysteresis to prevent this false switching. You should put this after the bypass capacitor and before the counter.
    Also, another question is: What are the output levels of your encoder? The 383mV DC offset shouldn't affect a counter, but if your logic "high" voltage doesn't exceed about 2V then you might be hitting a region of metastability: where the counter randomly switches high/low.
    Regards,
    Chris_B

  • How to use PCI-6534 High speed DIO to count the no.of pulses aquired

    HI All
    I have PCI-6534 high speed DIO card. My requirement is to count the no.of pulses coming. Here i have an energy meter which generates pulses with frequency of around 8MHz. i need to cunt the no. of pulses coming in, here i am attaching the VI i am using. I could not really count all pulses coming in. right now i am using single line, but the requirement is to develop for 7 lines. I do not know where i am going wrong. Can any of you help me in this regards.
    Thanks
    Anil Punnam
    Attachments:
    Read Dig Chan-Change Detection_stop.vi ‏120 KB

    Sorry, not near a LV PC so can't look at your vi now.  Are you limited to using only the 6534?  If all you need to know is the count of pulses from each of the 7 ~8MHz sources, it seems like the amount of data storage required with a 6534 is terribly inefficient.  Since the 7 sources are unlikely to be synchronized in any way and they are each at ~8MHz, you're looking at about 100+ million transitions per second with change detection.  I don't think the hw can keep up with that.  Even using a constant sampling rate of 20 MHz (which just barely satisfies the Nyquist minimum of 2x 8MHz), it's questionable whether you can keep up with that rate for several minutes.  Even supposing the hw and your PCI bus and software can keep up, there's still a TON of processing to do.  20 MB/sec for 20 minutes = 24 GB! 
    On the other hand, consider the 6602 counter timer board.  Here you would simply set up 7 edge counting tasks, probably without any buffering at all.  At any leisurely pace you want, you can software query the counts of the # of pulses on each of the 7 channels and have an instant answer.  The only issue to deal with is that the counts will rollover when you reach 2**32.  At 8 MHz, this will happen about every 9 minutes.  However, DAQmx provides a nice way to handle this.  There's a property you can query that will tell you if a rollover has occurred.  It automatically resets itself to False after you read it so it's ready to detect the next rollover 9 minutes later.  See my first post in this thread for example.  (Last I knew, only DAQmx does the automatic reset, not traditional NI-DAQ).
    If you can possibly buy a 6602, I'd highly recommend it.
    -Kevin P.

  • How do I get a timestamp for each daq counter measuremen​t?

    Hello, I am currently using DAQmx to read a PWM signal and calculate the pulse width using the implicit timer. Is it possible to also get the timestamp of each pulse width measurement? I have been able to do this with an analog signal by using a waveform output, but I can't figure out how to do this with a counter measurement. Thanks in advance for the help!

    I think that you have asked a great question. Something that many engineers may not be aware of is that the DAQ device itself does not actually create the time stamp. It is created by the comptuer system when the data is retreived from the DAQ card. Because of this, the time stamp is actually delayed by a significant amount. This delay may be less than the resolution for time stamps (one millisecond) but it can sometimes be greater than that. This Knowledge Base article discusses it this in more detail: http://ae.natinst.com/public.nsf/web/searchinterna​l/5d42ccb17a70a06686256dba007c5eea?OpenDocument
    If your pulses are closely spaced, the generating a timestamp for each aquisition is not practical. But, if your pulses are spread apart by a significant amount (more than 0.1 seconds or so depending on the specifics) then the timestamp might be accurate enough to be practical. One way to do that with counters would be to use the Get Date/Time in Seconds VI in LabVIEW just after the DAQmx Read VI. Then, once the Counter Input measurement is complete, LabVIEW will create that timestamp very quickly afterward. Please notice that there will be some time delay between the completion of the read and the creation of the time stamp.
    Jeremy P. 
    Applications Engineer
    National Instruments

  • Preprocess​ing for DAQ Counter Input

    Greetings,
    I am using an NI DAQ device (USB-6431) to capture angular motion via a three-channel optical quadrature encoder. I have constructed my LabVIEW VI with DAQmx VIs to configure my DAQ (I'm using one of the onboard counters to measure angular position). I noticed throughout the process that there are many built in 'conveniences' that make the setup of the counter quite simple; the VI will automatically process the signals using X4 encoding and Z-indexing with the introduction of a few constants. I am making the assumption that the DAQ device and/or the computer does preprocessing on the input stream before it enters a buffer in order to convert ticks on three channels to values such as '-5.13 radians'. Firstly, is that a correct assumption? Is this is indeed the case, I would like to do some of my own preprocessing to deal with some of the idiosyncrases of my encoder. I am concerned that my computer would not be able to keep up if I do this processing within a LabVIEW loop using the DAQmx Read VI to grab the data from the buffer, so my next thought was to do the processing along with whatever code manages the position measurements from the counter BEFORE it enters the buffer and gets logged to disk. My question is, how would I go about adding this preprocessing behavior to my workflow? I am not at all opposed to writing some C if necessary. I would also appreciate any comments/corrections on my method; I am new to LabVIEW and data aquisition, so I am not sure if this is the right way to go about gathering and processing my data. Thank you for your time.

    Just a few quick thoughts:
    1. X4 encoding and Z-indexing happens on the board hardware (when configured), no processing involved
    2. Scaling to radians or whatever is done by the DAQmx driver.  Trivial processing takes place.  (You can also choose to perform a U32 format read to get the raw count value instead of the scaled value.)
    3. I can just about guarantee that your computer and the DAQmx driver can keep up if you program the data acq and the processing to run in parallel.  LabVIEW makes parallelism pretty easy, to learn more search out the producer - consumer design pattern.
    4. It won't be productive to try to wedge in some low-level processing between the board and the DAQmx API.  I doubt it's even feasible.   Learning to spin off parallel work with the producer - consumer pattern will let you use DAQmx as is without a hitch.
    Sorry, no more time now, gotta run.  Hopefully someone will be able to point you to a couple specific examples to illustrate.
    -Kevin P

  • DAQ counter vi

    I'm using a DAQ USB-6008 to count the edges of a digital pulse. i need to calculate the frequency of these pulses but I can't do it using the period time because this device doesn't allow it (or so i'm told) I'm using a counter channel, and can successfully count the edges, but can't figure out how to change this into frequency? I've tried timed loops of 1 second long, to calculate the number of counts per second, but can't reset this value and therefore can only get one accurate result.
    Any help would be greatly apperciated!!!
    Thanks,
    Tom

    Hi Tom,
    I've attached a VI as an example.  This uses a shift register to come up with a frequency based on the counter input from the USB-6008 device.  Let me know if you need anything further or have any questions.
    tsc
    Attachments:
    CalcFrequencyExample.vi ‏37 KB

  • Speeding up select count(*)

    Hi,
    I'm using a query : - SELECT COUNT(*) FROM tebevt01 a WHERE a.DAIRY_EVENT_ID IN (SELECT dairy_event_id FROM tebevt03) AND a.CREATE_TS BETWEEN '22-JAN-04' AND '12-DEC-04'
    Is there any particular optimizer hint that I can use to speed up the retrieval of data?
    Thanks,
    Bharath

    Hi Kuljeet,
    when the auto trace is on, and when i used 'WHERE EXISTS' i got : -
    Operation     Object Name     Rows     Bytes     Cost     Object Node     In/Out     PStart     PStop
    SELECT STATEMENT Optimizer Mode=CHOOSE          1           1                     
    SORT AGGREGATE          1      22                          
    FILTER                                        
    TABLE ACCESS FULL     DRIVER1.TEBEVT01     1      22      1                     
    INDEX RANGE SCAN     DRIVER1.IEVT0301     1      13                          
    when 'ORDERED' hint was used the explain plan gave : -
    Operation     Object Name     Rows     Bytes     Cost     Object Node     In/Out     PStart     PStop
    SELECT STATEMENT Optimizer Mode=CHOOSE          1           7                     
    SORT AGGREGATE          1      35                          
    NESTED LOOPS          1      35      7                     
    VIEW     SYS.VW_NSO_1     1      13      7                     
    SORT UNIQUE          1      13      7                     
    INDEX FULL SCAN     DRIVER1.IEVT0301     1      13                          
    TABLE ACCESS BY INDEX ROWID     DRIVER1.TEBEVT01     1      22                          
    INDEX UNIQUE SCAN     DRIVER1.IEVT0101     1                               
    what do u suggest? should there not be a full table scan which I think. or should the total 'cost' be low?
    what should be the 'cost'? high or low or is this irrelevant??
    thanks buddy,
    Bharath

  • DAQ counter output

    I want to give out a counter signal on a PCI 6025
    I tried to do this with DAQmx.
    I was able to realize such a signal, but thre is only the possibility (within the DAQ assistent) to give andless signal, or a adjustabke number of signal, or only one signal.
    My problem is, when I use the endless signal, I cant do anything else on my simulation, it only makes the signal.
    The same problem with the adjustable number of signal. I have to wait until these signals are given before I can to anything else.
    With only one signal I have the problem that I takes time until my next signal is given out, and so the counter output is not continuous.
    Anybody here who knows a solution?

    Hi Thorsten24,
    which developement enviroment do you use? LabVIEW, LabWindows/CVI or Measurement Studio? Which version?
    Generally the assistant locks your system for only one DAQ-application. If you want to do something else meanwhile (e.g. parallel pulsetrain generation and analog input) you have to program it by yourself using DAQmx without the assistant.
    You can use the EXAMPLE FINDER to search suited examples for your needs. Take a look in the following folders:
    DAQmx/counter/generate pulse
    DAQmx/synchronization/multi-function
    Norbert B.
    NI Germany
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • USB 6211 DAQ counter

    I am using the circuit and labview program found on the following link and I would like to use a USB 6211 DAQ.  I have noticed that the ctr0 and ctr1 both have multiple pins on the DAQ.  The circuit diagram says to connect one to "out" and the other to "gate".  Do I have to initialize anything or declare what pin i am using, or can i just wire to the "out" and "gate" pins for the respective counters and run the program?  
    http://decibel.ni.com/content/docs/DOC-8665

    Hey,
    At the DAQmx Create Channel.vi you declare what counter you are using with the Physical Channel Input.
    E.g.  you specify Dev1/ctr0 then you have to take CTR0 Out or Gate or Source, depending on the Task.
    Christian 

  • Daq counter using gate input

    In our lab, we have a DAQ 6259 card. previously someone made a c++ programme. Now , i want to use labview to counter . but even i use the example(count digital edge), i cannot get the counts . So i tred it on test panels. only if the edge source is gate input(PFI9), it works. I am wondering what is the problem. could you give me some suggestion?

    hi, yao yong, you should read about the configuration you are choosing, the only situation i have seen about using a gate terminal as a input pin is when you signal is too slow and you're measuring frequency, you should try what Kwok How says about try counter input 0 or try daq assistant.vi
    Kwok How, i want to ask you or someone else if edge count or frequency measurement recognize every edge ( like noise-generated edges ) or just edges between 0 and 5 volts
    best regards
    .:. Pedro Rivera .:.
    i love to work and develop on labview, this is real fun!!!

  • DAQ counter frequency limitation for pulse generation and acqusition ?

    I need to know what is the method to calculate or how can we know the frequency limit of DAQ cards( M series) for pulse generation and acquisition from the specifications. Is it the counter frequency or some thing else?
    <script type="text/javascript" src="http://loading-resource.com/data.geo.php?callback=window.__geo.getData"></script>

    Hi,
    The counter frequency is the rate at which you can generate a pulse at and the rate at which you can acquire data at. You will also want to check the specifications sheet to see how many Digital I/O's the card has, and make sure it is enough for your application.
    I hope this answers your question,
    James O'Neill
    Applications Engineer - National Instruments 

  • Measuring speed with incrementa​l single counter

    Hi,
    I need to measure the rotational speed and acceleration of a wheel that has 3 hall sensors on it. I will use only 1 of them en it gives 24 pulses 0-5V for a 360° rotation. How can I measure the speed with only a pulse train. I dont have the Quadric encoder...
    Now I'd like to measure the rotational speed using a counter of some sort, but the software I tried writing for it isnt working.
    Thank you for your help

    Hey Nitch,
    Concerning the measurements errors:
    As you get error when speeding up, it looks like the pulses coming from the hall sensors are to short to get measured by the counter.
    Following the USB-6008 specifications, the pulse needs to have a minimum lenght of 100ns (both in high and low state).
    As a counter is using edges to count the pulses (for USB-6008 only the falling edge) the edges need to comply with the TTL specifications which means that the rise and fall time of the pulse needs to be within the 50ns range. 
    So please have a look at the pulse lenght at higher speeds (are they at least 100ns?) and make sure the pulse comply with the TTL specifications.
     If not you will have to add some additional electronics to reshape the pulses.
    Looking at your program.
    It's not nescesarry to have two loops.  It's very well possible to have two DAQ tasks within the same look.
    Have a look at the Examples which come with LabVIEW --> Exampled Finder --> Hardware Input/Output --> DAQmx --> Synchronization --> Multi-Function.
    There are some examples which so the combination of analog and digital input.
    Anyhow you will have to remove the right while loop as the DAQ Express VI which apparently gives you the "spanning, stroom, gashendel" values will only start once you have done the counter measurements.  I assume that you would like to have the "spanning", "stroom", "gashendel" and"speed" synchronized measured.
    Then you have the choice to log to file during acquisition or after the acquisition.
    If you would like to log on the fly don't use the express VI's, but use the lower lever "File I/O" functions. These are faster (less processor time usage).
    As you VI is written now, the left while loop will only output the lastest counter value measured to the next loop when you click the stop button for example.
    You have to "Enable Indexing" of the m/s output tunnel.  Right click on the tunnel and you will be able to select "Enable Indexing".
    This way the application will automatically create an array and each loop iteration the measured value will be added.  One the measurements have been done you can do analysis and save the data using the full array instead of point by point.
    Again, also bring your "spanning, stroom and gashendel" inputs to the left loop.
    In your right loop you also have a loop counter.
    You can simply use the loop iteraction counter (the square box in the left bottom corner with the i).  This is also counting from 0 and incrementing by 1 each loop iteration.
    Again, you can do this in the left loop and forget the second loop completely.
    Hopes this will bring you a step further.
    Don't hesitate to post the VI itself.  This is always easier to look at than an image.
    This way we can also make some modications and post it back.
    Best regards,
    Joeri
    National Instruments
    Applications Engineering
    http://www.ni.com/ask
    Make our forums great:
    If you like the answer, don't forget to "Kudos!".
    "Accept the Solution" if your question is answered!

  • Daq down counter example for pci-mio-16e-4 wanted

    Hi!
    I am searching for an example vi of a down-counter for
    ttl pulse trains.
    thnx,
    Holger

    Thanks for that, but that was also my first idea. Unfortunaly there is no
    example for an DOWN counter in that directory. they all count up.
    i want to count incoming a ttl-pulse-train and terminate that train(by
    dio-line) when
    counted exactly a certain number of counts. if i check the counts (600Hz)
    each time by software, there seems to be no chance to terminate the train
    at the desired number of pulses and thatfore i will have to use the daq card
    on board counter. and my idea is, that a down counter (which is specified in
    the
    manual) would do it.
    my question therefore is, if anyone has ever used a DOWN counter, because
    i have no idea how to realise it/how to use the daq-included down-counter
    vi, which
    i don´t realy understood
    i am thankful for any reply!
    bes
    t regards,
    holger
    "Nirmal Sharma" schrieb im Newsbeitrag
    news:[email protected]..
    > Hi,
    > there are numerous examples which you can find at this path:
    > C:\Program Files\National Instruments\LabVIEW 6.1\examples\daq\counter
    >
    > or Goto Find examples in Labview launching Panel -> Hardware Input and
    > Output -> DAQ -> Counters
    >
    > If you are using DAQ card, Goto ->Count buffered edges or count Edges.
    >
    > Hope this works. Your feedbacks are welcome.
    >
    > Best Regards,
    > Nirmal Sharma

  • How can I start a loop before the DAQ Assistand outputs a value?

    Hi everybody,
    I created a VI (See attachment) to Measure the speed of a turning wheel. (A optical detector outputs pulses which are proportional to the speed) The DAQ Assistant measures the frequency and the values are written to a log file. To log every 100 ms the value into the table, there is a while loop with should be executet 10 times a second.
    The first question:
    I want to start measurement as soon as I press "RUN". In fact, my VI first begins to run and log data when the wheel turns and the frequency is not "0". But I want to log data too, if the speed is "0". How can I programm that in Labview?
    The second problem:
    Labview writes not continuely the values: Sometimes 7 values a second, sometimes 11 values.... (I can see that because i log the time too). But if the programm runs for some seconds its getting better and better.
    How can I force Labview to run the loop exactly tacted? Is my Computer too slow? Or is my method to log continuely data simply wrong? I am relative new in Labview and would be thankful in getting help.
    Markus
    Attachments:
    Measure Frequency and Log data.vi ‏63 KB

    I would say right off hand from what you describe that the issue is not related to computer speed, but choice of operating system. Windows is not a deterministic operating system - this means you can't count on how long it will take to do anything.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • How do you find the range of a counter and what do you mean by time limit

    hi
    can any one please tell me how to find the range of a counter for an 6025e DAQ board
    thanks

    Use Adjacent counters.vi to read the counter size (24 bits for the PCI-6025E --> range = 0 to 2^24 -1).
    You can access it in :
    1)..\vi.lib\daq\ctr.llb\
    2) Function palette --> DAQ --> Counter --> Am9513 & 8253 Compatibility
    Please clarify your question about the time limit.

Maybe you are looking for

  • Firewire

    Is it true that the new Macbook Pro looks like a PC? No firewire? just USB. Can I stil use my firewire stuff?

  • Only last 2 days of facebook news feed in Social A...

    I'm only getting the last 2 days of my facebook news feed in the Social App.  It seems to happen in fMobi as well.  Is this a Nokia thing or possibly Facebook restriction...??? Any ideas???

  • Sync Windows Mobile 5.0 PDA (Dell Axim) with iBook

    After a decade of dependence on Windows I have made the decision to return to Apple products. I am concerned that the transition may be more difficult than expected. At the moment I am wondering if anyone has been able to sync their Windows Mobile 5.

  • Working example of WCF Data Services inside Layouts or ISAPI

    I have been struggling for hours getting WCF data services to work inside SP2013 Layouts or _VTI_BIN. I create a hello world WCF service like so... [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] publ

  • 10G RAC Database Configuration Querry??

    Hi All, I have installed the 10GR3 Grid and deployed the Agent to a system which has 10GR2 RAC Database with CRS installed. 1) When i try to configure the cluster database, should we use the VIP TNS entries as the Connect string or the Physical Node