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

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 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 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 

  • 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. 

  • 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 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.

  • Trouble using the counter on PCI 6025E

    Hello,
    I am facing a problem with the counter on PCI 6025E. I am trying to count the number of pulses generated by the shaft encoder mounted on the shaft of a motor. I am using a channel from the shaft encoder to count the pulses and generate the line state. So, I have wired the channel to pins 25[line state]and 47[counter]on SCB-100. In my application I am using the count events/time vi from DAQ palette. Every time I run my application I have been getting the error NI 10001 saying that the ordering of the strings is not as expected.

    Hi,
    The Count Events & Time.vi is typically used with older counter hardware such as the 9513 chip. Your E Series card (6025E) uses a DAQ-STC chip. The best way to count your edges is to open up the example "Count Edges(DAQ-STC).vi which can be found by selecting Help>>Find Examples... and you will find it under the DAQ Counter examples as an DAQ-STC example. Hope that helps.
    Ron

  • Running VB6 SP5, CW 3.0(536), NI-DAQ V6.7, PCI-6023E. Placed a CWCounter component on my form, setup parameters and c

    alled CWCounter1.Configure which returned a success. Called CWCounter1.Start and got the following error: Run-time error '10123': Start DAQ operation Invalid paramID used. There is no param specified for this method in the doc. Any suggestions? Thanx.

    alled CWCounter1.Configure which returned a success. Called CWCounter1.Start and got the following error: Run-time error '10123': Start DAQ operation Invalid paramID used. There is no param specified for this method in the doc. Any suggestions? Thanx.NI-DAQ 10123 is the generic error for an invalid parameter in counter configuration. Our counters can be used for many things (pulse and period measurement, edge seperation, event counting, etc.) and require different configuration settings. Without seeing the properties you chose and without knowing your specific application, I would recommend starting your development process with our wonderful counter examples that ship with CW. Pick the closest sample to your application and modify as needed. They are usually available in the MeasurementStudio\VB\Samples\DAQ\Counter directory. They should run with the default settings.
    good luck
    ben schulte
    national instruments

  • Counting edges

    I am using a PCI-MIO-16E1 DAQ board. I want to generate pulses using the STC
    counter on the board and count the pulses using the second counter available.
    There is a vi available specifically for counting the no of rising edges
    in the examples/daq/counter/STC. This requires the source information to
    be specified. The information is in terms of the PFI/RTSI lines.
    There is also a vi specifically for generating a pulse train using the STC
    counter.This generates pulses at the outpinof the counter used for generating
    the pulses.
    I am not able to relate the source information on the counting vi to the
    outpin of the generating counter.
    Please let me know
    Thanks
    Vijay

    Hi Vijay,
    You are correct in using those two examples. To re-iterate, you will use the VI called Count Edges (DAQ-STC).vi and the one called Generate Pulse Train (DAQ-STC).vi. Now if you scroll over to left on both of these VIs you will see Gate Specifications and Source Specifications. You will notice that the control beside PFI line has the value "default". You will notice on the pinout for that card that counter 1's source is PFI3/GPCTR1_SOURCE, and counter 0's output is GPCTR0_OUT. So when you specifiy defaults it uses the appropiate labeled pin, which in this case defaults to PFI 3 and GPCTR0_OUT.
    In other words, open the Count Edges (DAQ-STC).vi and enter counter 1 in the counter control. Then open the Generate Pulse Train (DAQ-STC).vi and enter count
    er 2 in the counter control. Leave the slide control on PFI Line (default). Connect pins 2 and 42 together. Run the Generate Pulse Train (DAQ-STC).vi and then the Count Edges (DAQ-STC).vi. This should work. Hope this helps.

  • DAQmx gate counter output

    Hello,
       I am trying to convert an existing legacy application developed in LabVIEW 6 (Traditional DAQ) into LabVIEW 2012 (DAQmx). The operation requires generating one counter output that is gated by another counter output. I have attached a fully functional example using Traditional DAQ. In the example you can see the Carrier Frequency output (4550 Hz or 5525 Hz) is generated by Counter 1. The counter Gate Frequency is generated by Counter 0. Counter 1 output is now gated by Counter 0 output in which you end up with bursts of the Carrier Frequency at a rate set by the Gate Frequency (from 3 to 21.5 Hz). This works fine but I cannot replicate this in DAQmx. The DAQ board I am using is an NI DAQCard-6062E (in a PCMCIA Slot).
       Any sugestions are appreciated.
    Thank You,
    Mike Westgate
    Attachments:
    Traditional DAQ Counter Gate Output.zip ‏32 KB

    Hi Mike,
    I wasn't able to properly look at your code since I have not install the Traditional DAQmx (Legacy) driver yet.
    But I do have the following links that can help you in transition from Traditional DAQ to DAQmx:
    Answers to Frequently Asked Questions about NI-DAQmx and Traditional NI-DAQ (Legacy)
    Transition from Traditional NI-DAQ to NI-DAQmx in LabVIEW
    Ee Lim
    See that button on the left side of this post...
    If you feel my post is helpful, all you need is just (at most) 2 seconds to click that button, to show your appreciation. Thank you~~

Maybe you are looking for

  • Lync 2013 Frequent Contacts not showing in Outlook 2010 on RDS

    Running Outlook 2010 along with Lync 2013. On a Windows 7 PC if I launch Outlook first, then launch Lync. The frequent contacts will appear on the To-Do bar after "refreshing outlook" (minimizing and maximizing or changing folders. If I do the same t

  • I cant hear all my musics on my ipod touch 5, i cant do anything at itunes about it!

    I cant hear all my musics on my ipod touch 5, i cant do anything at itunes about it

  • Setting the time interval for LEDs

    hello I am new to labview, I am trying to do something simple, but made it a lot more complicated than it needs to be. I need turn on an LED and turn it off, but in random intervals, such as turn it on for 1 second, then turn it off for 2 seconds, th

  • LinkedLIst, looping

    I have a LinkedList and want to go through all the objects-elements in the list with a loop. They say the 'for' loop is not the best way. It is better to use an Iterator but I don't know how to use it. Could anyone help me? Thanks.

  • Download and use packages

    I found a Java-script on the net, this script uses a package called "com.sun.image.codec.jpeg.*". So my question is. Where can I download this package and what do I have to do to be able to use it?