New M Series DDK Example: High Frequency Measurement with 2 Counters

This example demonstrates how to configure two counters on an M Series device to measure a high digital frequency. One counter generates a continuous pulse train of a set frequency while the other counts the external signal using the pulse train to latch values. Data is transferred via DMA.
Use this example to add high digital frequency measurements or DMA data transfer for counter input to your driver.
Please let me know if you have questions or problems. Thanks :-)
Joe Friedchicken
NI VirtualBench Application Software
Get with your fellow hardware users :: [ NI's VirtualBench User Group ]
Get with your fellow OS users :: [ NI's Linux User Group ] [ NI's OS X User Group ]
Get with your fellow developers :: [ NI's DAQmx Base User Group ] [ NI's DDK User Group ]
Senior Software Engineer :: Multifunction Instruments Applications Group
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
Attachments:
gpctex5.cpp.gz ‏4 KB

You should connect the signal (whose frequency needs to be measured) to Ctr-1, and there gonna be an internal connection between the output of the first counter and the gate of the second counter (as described here).
You may want to check this link as well.
I am not allergic to Kudos, in fact I love Kudos.
 Make your LabVIEW experience more CONVENIENT.

Similar Messages

  • High frequency measurement 2 counters range

    Hello,
    I know this info is somewhere but I can't find it.
    When using a Counter/timer to measure frequency there are multiple methods.
    i.e. Low Frequency with 1 counter and high frequency with 2 counters.
    What is the definition of a "low frequency" and what is the definition of a "high frequency"?  i.e. low frequency = frequencies below 100 Hz 
    Also what is the definition of a "large range"?
    Thanks
    Dan

    Hi Dan
    There isn't a specific bandwidth that is defined for use with either the one-counter or two-counter method. However, located in the NI-DAQmx help file there is a section detailing the quantization errors that arise when using either method with a variety of input frequencies. By referring to this information you should be able to determine which method will produce the smallest error in your application and hence which method will be preferable. This help file also explains the errors associated with the large-range two-counter method.
    To locate the help file, you should select Start»All Programs»National Instruments»NI-DAQ»NI-DAQmx Help, and search for 'quantization error'.
    I hope this helps, just let me know if you'd like anything clarified or if you have any other questions on the matter.
    Regards
    Jeremy T
    Technical Marketing Engineer
    National Instruments UK & Ireland

  • DAQmx Error 89137 When trying to make a high frequency measurement.

    I am using a PCI-6602 Timer/Counter for multiple measurements on a serial interface...
    I have the clock line connected to Gate0, the enable line to Aux0 because I need to make a two-Edge seperation measurement between the two later...
    But I also want to make a "Period/Frequency Measurement (High Frequency with Two Counters)" measurement...
    This requires that the signal to be measured is on Source0...
    I implimented the following Code:
    void meas_FP_Freq(float64 *Freq0, float64 *Freq1)
    TaskHandle CLK0_Freq, CLK1_Freq;
    DAQmxCreateTask ("FP_CLK0_Freq", &CLK0_Freq);
    DAQmxCreateTask ("FP_CLK1_Freq", &CLK1_Freq);
    DAQmxConnectTerms ("/Dev3/PFI38", "/Dev3/Ctr0Source", DAQmx_Val_DoNotInvertPolarity); // Gate0 to Source0, No Error....
    DAQmxConnectTerms ("/Dev3/80MHzTimebase", "/Dev3/Ctr1Source", DAQmx_Val_DoNotInvertPolarity);
    DAQmxCreateCIFreqChan (CLK0_Freq, "Dev3/ctr0", "", 6000000, 6500000, DAQmx_Val_Hz, DAQmx_Val_Rising, DAQmx_Val_HighFreq2Ctr, 0.001, 4, "");  // High freq measurement
    DAQmxCreateCIFreqChan (CLK1_Freq, "Dev3/ctr1", "", 6000000, 6500000, DAQmx_Val_Hz, DAQmx_Val_Rising, DAQmx_Val_LowFreq1Ctr, 0.001, 4, "");
    DAQmxReadCounterScalarF64 (CLK0_Freq, 3.0, Freq0, 0); // Run-Time Error -89137 Specified Route cannot be satisfied..etc
    DAQmxReadCounterScalarF64 (CLK1_Freq, 3.0, Freq1, 0);
    DAQmxDisconnectTerms ("/Dev3/80MHzTimebase", "/Dev3/Ctr0Source");
    DAQmxDisconnectTerms ("/Dev3/80MHzTimebase", "/Dev3/Ctr1Source");
    DAQmxClearTask (CLK0_Freq);
    DAQmxClearTask (CLK1_Freq);
    The "Low Frequency" method works fine, but the resolution is too low...
    Every help file I've read indicates I can use different PFI inputs for measurements... What am I missing?

    Hi,
    The reason that you are getting the error is the PFI lines are being reserved twice. You don't need the DAQmx Connect Terms functions in your code because the DAQmx driver does this for you automatically. If you still receive an error after doing this, try to changing the low frequency counter number.  I hope this helps you with your application.
    Regards,
    Hal L.

  • High frequency sound with K8T Neo-FIS2R

    Hello!
    I have the MSI k8t neo-fis2r mainboard with bios v 1.6 and sometimes it makes a horrible high frequency sound and I cant figure out why.
    My system are:
    amd 64 3000 cpu and
    Corsair Value S PC3200 DDR-DIMM 512MB Unbuffered, Non-parity, 64Megx64, CL2.5
    My other components does not cause the sound (that I have found out by testing).
    I wonder if the ram causes the sound? Can you please help me. The sound is so bad that I cant use my computer. It only appers during heavy system load, and not in windows. It has nothing to do with my video card (because I have tried with several different cards). My bios settings are default values + cool and quit enabled. I have the core center installed so the progam controls the cpu fan.
    I really hope someone can help me.

    The sound does not come from the speaker and I dont think it comes fom the cpu fan either. I think it comes from the motherboard, ram or the cpu. When I dont use my mouse it is quit but when I clik it makes this sound. Can it be that I have to set all values in bios for ram etc. manually instead of automatic?
    When it comes to other electrical sources I have a TV standing 0.5 meter from the computer. Could thins cause the problem? I did not have the problem with my old motherboard which was a MSI K7T Turbo2.
    The sound usually appers when I am benchamarking my system. For example 3dmark 2004. Because of this I thougt there was a problem wiht my vga card but after a changed to a new one...the situation was just the same.

  • NI9411 frequency measurement with analogue output

    I have an NI-9411 connected into a 9178 cDAQ module. I want to constantly measure the frequency of a digital signal then output this signal as an anlogue output using another of my NI modules. I am pretty new to the NI environment, does anyone know of a simple method using the DAQassistant?
    Thanks for your help.
    Richard

    Hi Richard,
    Do you want to output a voltage that varies with frequency or just an analog signal with the same frequency as the digital?
    The easiest way for you to do this is to use two DAQ Assistant VIs and wire the output from your digital module into the output of your analog module.
    If you wanted to output a varying voltage with frequency you would perform some simple scaling on your measured frequency and wire it straight to the output.
    If you wanted a varying frequency analog signal, you could use the Simulate Signal express VI and wire the measured frequency into the frequency input.
    The reason you only see four channels for frequency measurement is that this particular function utilises the hardware counters on your device to count the time period between pulses to work out the frequency, your cDAQ 9178 has four of these hardware counters.
    For direct voltage level measuring you will see six differential channels available.
    Hope this is helpful to you.
    Regards,
    Adam Brown
    Applications Engineer
    National Instruments UK

  • High frequency measurement

    I need to measure a frequency around 3 Mhz the signal is in bursts.
    I have the example 2 counter.vi working with a siggen with a continuous output but can't get a reading on the burst.
    Below is the vi and scope shots of the signal I need to measure.
    Attachments:
    DAQ Counter.png ‏41 KB
    freq1.png ‏46 KB
    freq2.png ‏44 KB

    johnsold wrote:
    I suspect that the best way for you to measure the freqeucny of the bursts is to use an analog acquisition with a sampling rate of at least 10 MHz (higher is probably better).  Then do an FFT on each burst. The images you posted earlier show about 30 cycles in a burst.  That is enough to get a reasonable response from an FFT.  You could also detect zero crossings and calculate the frequency from that.   FFT may be easier.
    Does the frequency vary within a burst?  Does it vary from one burst to the next? What is the range of frequencies in the bursts? What frequency resolution do you need? How fast do you need to analyze the data? Between bursts or seconds later?
    Lynn
    The frequency is constant in each burst and is the the same from one burst to the next.
    Resolution does does not need to be real acurate .5 mhz would work, but the more acurate the better..
    I have lots of time to analyze the data at least 30 seconds to capture and analyze.

  • Frequency measurement with High Speed Digitizer using External Trigger

    Hello:
    I

    Hello;
    That is happening because you are doing Software timed operation, and since Windows manages all tasks that runs on the machine at any given time, your VI might take different times to execute, and that might be enough for you to miss some pulses.
    The best way to do that is by using a 660x board, and have three counters doing the job. The firts counter can be configured as the first pulse train generator, the second counter can be used to generate a pulse that will trigger the third counter of. That pulse will be generated when the delay of 90 degrees is reached. So, the second counter will count events and will be triggered of by the pulse train generated by the first counter.
    The third counter is configured as triggered pulse train generator, and t
    he output pulse of the second counter is used as the trigger pulse for the third counter.
    If you don't use that approach, you won't be able to reach fast speeds and might also miss some pulses, due to the Software timed approach.
    Hope this helps.
    Filipe A.
    Applicaions Engineer
    National Instruments

  • What is the accuracy of frequency measure with PCI 6023E?

    I am measuring the exact frequency of 2.7Mhz signal. using PCI-6023E ,how can i calculate the accuracy of the measurments?

    See
    http://exchange.ni.com/servlet/Redirect?id=8437352
    Regards
    Filipe A.
    Applications Engineer
    National Instruments

  • High frequency power measurements

    Hey,
    I'd like to know if there are developments in measuring electrical high frequency signals with labview without using an extern power analyser. At the moment i'm using a yokogawa power analyser but i'd like to know if it's possible to log HF signals without the help of a power analyser... Are there NI products on the market for this purpose?
    Thx,
    Andy

    Hello,
    In the case of frequencies up to 200 KHz, NI can provide several solutions using the 'standard' data-acquisition boards or digitizers (scopes), from a low to very high accuracy solutions.
    A good solution can be one of the high speed M-series boards (PCI-625x).  These boards have up to 32 multiplexed channels with a resolutions of 16-bit at a speed of 1 MS/s  (500 KHz).
    A better solution would be a S-series boards.  These data-acquisition boards sample all input channels simultaneously.  We have boards with 2, 4 and 8 channels and sample frequencies of 10 MS/s  (up to 5 MHz if needed).  S-series board are the boards with product numbers PCI-61xx.
    The best solution is to use a digitizer (scope).  Also here a lot of possibilities going from low to higher bandwidth and resolution.
    The most flexible is the PXI-5922.  A 24-bit digitizer if you sample @ maximum 500 KS/s.  This board only exist in the PXI platform.
    Then NI has 8-bit digitizers (normal resolution for scopes) from 15 till 125 MHz bandwidth.  If you need a higher resolution they have solution up to 14-bit (very high for scopes) @ 100 MHz.
    Please give your local NI Office a phone call.
    They have technical engineers who can discuss your needs and provide you a solution.
    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!

  • NI9411 wrong frequency measurement of flow sensors / 24 impulse signals

    Hello Ni Forum,
    I already searched for similar problems, but haven't found anything helpful. So I'm posting our problem here. I'm apologizing in advance for bad english, it's not my mother tongue
    We're encountering some strange behaviour of our NI9411 Module. We're using it in a Compact Rio with some other modules (2x Analog In).
    Our goal is to measure the frequency of three flow sensors (impulse high = 24V, 0-22kHz) among with a torque sensor (TTL 5V, 30-60kHz) and a speed sensor (TTL 5V, 0-51,2kHz).
    They are wired as follows:
    DI0a = torque sensor
    DI1a = flow sensor 1
    DI2a = speed sensor channel A
    DI3a = speed sensor channel B
    DI4a = flow sensor 2
    DI5a = flow sensor 3
    Correspondig ports b are left unconnected, as it is said in the data sheet. All ground ports of sensors are connected to COM port of 9411. The module was connected to a 24V power supply.
    Now the torque and speed sensor measurement works fine. But measuring the signals of the flow sensors seems to be difficult.
    If an external frequency generator (impulse high about 9V, f=1,000kHz) is connected to port DI1a instead of the sensor signal, LabView shows exactly 1,000kHz. DI5a showed an avarage of 10 Hz, with a range from 10 to 60 Hz. DI4a equaled constant zero. The flickering up to 60Hz of DI5a was gone after disconnecting the 24V supply of the module. This changed nothing on the phenomenon described below.
    If the signal high impulse voltage is raised, the measured signal frequency goes up to 1300 Hz @ 24V signal high impulse voltage. The signal additionally raises, if an oscilloscope is connected to DI1a, to 2180 Hz (range 2110 to 2240Hz). However, there is no change of frequency if the osci is connected to DI5a. With the 24V supply connected, DI5a showed a frequency up to 600Hz @ 24V signal high impulse voltage on DI1a, also rising when connecting the osci on DI1a. As mentioned, there was no frequency measured on DI5a after disconnecting the 24V power supply.
    The signals of the generator showed some peaks on each edge (rising and falling) with values for example of 11V above high impuls voltage of 9V (20V together). That may causes that wrong frequency measurement.
    The signals of the flow sensors do not have such peaks, the LabView-frequency nevertheless does not match the real frequency, as shown below (all values in Hz):
    LabView
    ideal values
    Flow Sensor 1
    Flow Sensor 2
    Flow Sensor 1
    Flow Sensor 2
    4600
    12200
    740,6
    6760,0
    6400
    13500
    1481,3
    7500,7
    9700
    16400
    2962,6
    8982,0
    12900
    19500
    4443,8
    10463,2
    We're kind of helpless now. How can we get the signals of the flow sensors measured the right way? Are we doing something essentially wrong? Thanks in advance for offered help. I hope, I've given any necessary information. Any missing details will of course be delivered.
    Puls-Measure-VI is attached beneath.
    Regards,
    Johannes Rost
    Attachments:
    vi.png ‏20 KB

    Dear Lynn,
    thank you for your reply. The impedance was an issue that our local technical distributor already suggested to check. According to the datasheet of the flow sensor (see attachement) it can drive a current of 25mA. The signal generator we used is a test generator that can be used instead of the flow sensors to check the any evaluation unit the sensor is connected with. So it should generate signals that are equal to those the sensor would have generated. And even with this the frequencies measured with LabVIEW are not as expected.
    We are in contact with the sensor manufacturer to exclude mistakes in connection on the sensor side. But the behavior with the signal generator makes us think that is has to do something with the characteristics of the NI9411 that we don't know yet.
    Attachments:
    block diagram signal amplifier and signal description.png ‏151 KB
    technical data.png ‏124 KB

  • Frequency measurement question

    hi,
    i'm trying to get a graph/table of the frequency of a signal as it varies with time using LabVIEW 8.2. the frequency of the signal i'm analyzing is constantly changing, so i would like to, ideally, find the frequency of each pulse so that i would be able to graph that frequency as a function of time. the signal is generated by a fiber optic system which is hooked up to a standard NI DAQ card.
    right now i'm trying to use the Spectral Measurement VI wired to a graph, however it doesn't seem to be producing the desired results.
    thanks

    Hi Ben,
    Ah, I get it now, thank you for the pictures.
    "Just
    to clarify, does the Counter I/O -> Frequency task work with
    non-digital signals?"  No, the input to a counter task must conform to
    the 5V TTL logic standard.  Here
    is a document that talks about how to use non-TTL signals with counter
    tasks.  Since you are interested in the length of time between two
    adjacent peaks or troughs, it would be nice to use a digital frequency
    task, but this analog signal needs a lot of help before you can use it
    as a TTL counter input.
    "Also,
    it would seem that the Analog I/O ->
    Frequency would be the ideal task for my application, however it
    doesn't seem as though it is supported by my card..." You are correct,
    you cannot directly take an analog frequency measurement with your
    hardware.  Different hardware is required.
    What's coming to mind is a direct measurement between two adjacent peaks and troughs.  LabVIEW ships with some very nice examples for this type of measurement.  From LabVIEW's Help Menu >> Find Examples... >> Analyzing and Processing Signals >> Time Domain Analysis >> Peak Detection and Display.  Please note that some of the VIs required by this example are not included in the LabVIEW Base Package.  Below is a screen shot of the front panel.  Computing the frequency of each pulse is then a matter of calculating the time between two adjacent peak or trough values.  I hope this gives you some ideas.
    Message Edited by Pie56694 on 07-09-2008 11:34 AM
    Message Edited by Pie56694 on 07-09-2008 11:35 AM
    Attachments:
    2008-07-09_101048.jpg ‏94 KB

  • High frequency and resolution with 6036E

    I am trying to drive a triangular wave signal with about 250Hz, with the greatest resolution possible. However, due to buffer restrictions and sampling restrictions, I can't seem to be able to produce more than about 10 Hz. Is there a really good way to produce such a higher-frequency signal, with no loss to resolution?

    It looks like you need a faster output card. The best that the 6036E can do is about a 10kHz update rate. Do the math and that means cranking as hard as it will go, the card will only put about 40 updates in each cycle of the output waveform.
    From what you said, a 10 Hz signal is ok. So if you extrapolate out to 250Hz you need to be looking for a card with an update rate of about 250kHz--all things otherwise being equal.
    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

  • Modify example "Frequency Measurement.vi" for cFP to read two channels

    I am using the cFP-CTR-502 to measure frequency on one channel using a modified version of the built-in example, "Frequency Measurement.vi" found under 'Hardware Input and Output>Fieldpoint>Advanced'.  How do I modify this example further to incorporate additional frequency-measurement channels?

    AEICincy,
    Modifying the example for multiple frequency measurements shouldn't be too difficult.  If you wish to use the same gating pulse, the only thing you need to do is set up a new channel in MAX (set it up the same way you set up the first channel as per step 3 of the instructions), set the counter channel on the new front panel controls, and add code to read and reset the counter (which can be copy/pasted in the False case of the code).  I have attached an example of a VI with these changes.
    Message Edited by Devin_K on 01-28-2008 08:38 AM
    Devin K
    Systems Engineering - RTT & HIL
    Attachments:
    Frequency Measurement.vi ‏106 KB

  • New ipad has a high frequency buzz when connected to docking station.

    New ipad creates a high frequency buzz/sensation when charging on the docking station and does not have buzz when connected directly to usb charger?

    It is hard to be sure without seeing it, but it sounds like a bad connection to the docking port. (bad motherboard)

  • Bug in M Series C/C+ DDK example (Mac OS, endianness​)

    I am trying to get C/C++ examples for the M Series DDK running on Mac OS 10.4 with Xcode 2.2 and have run into an apparent bug. When converting the EEPROM values into usable data (e.g., finding scaling constants), the function "getF32FromEeprom" in "scale.cpp" is called. In the original version, this function is:
    f32 getF32FromEeprom (const u8 *eepromMemory, u32 offset)
    tEepromF32 value;
    value.b[3] = eepromMemory[offset++];
    value.b[2] = eepromMemory[offset++];
    value.b[1] = eepromMemory[offset++];
    value.b[0] = eepromMemory[offset++];
    return value.f;
    This bit order is backwards for Mac. The example programs work when this function is switched to:
    f32 getF32FromEeprom (const u8 *eepromMemory, u32 offset)
    tEepromF32 value;
    value.b[0] = eepromMemory[offset++];
    value.b[1] = eepromMemory[offset++];
    value.b[2] = eepromMemory[offset++];
    value.b[3] = eepromMemory[offset++];
    return value.f;
    After making this switch, my board (6259 PCI) happily spits out the correct voltages.
    It looks like there are compiler switches in other parts of the code to test for big endian vs. little endian, but this piece of code snuck through.
    Is there a list of known bugs in the sample code? I stumbled across a post about a different bug and wonder if there may be more.
    Melissa

    So far, there's the problem you are describing and a bug in the ADCReset function for 625x devices:
    Driver Development Kit (DDK) : inputs return minimum value
    Diego

Maybe you are looking for

  • J1IEX, error while posting Excise Invoice

    Dera Gurus, While posting the excise invoice for the invoice which has already been captured at the time of MIGO, I am getting the error message " All Part I entries have been canceled for excise invoice 5810 2009" I have checked the PO history and f

  • Dimension Table that doesnot join to any fact source

    Hi, I'm getting an error while Consistnecy Check that 'Dimension Table that doesnot join to any fact source' but in my physical layer i did not join to any fact table. where as i've a fact in BMM layer . Cany any one help me on it. Thanks, Malli

  • How to reference InDesign CS 5.5 in a vbscript?

    Having done mostly AppleScript and JavaScript in recent years I got stuck on what must be dead simple, but I can't figure it out, that is, how to create a reference to the InDesign application object. With previous version this is what I do set myInD

  • Finding errors in a Coldfusion source file at compile time

    My application is built using Coldfusion, Flex and MySQL as backend. I am using FlexBuilder 3 for editing/compiling the Flex source(MXML and Actionscript) files. For the Coldfusion(CF) source files(cfm and cfc files), I am using Coldfusion Builder to

  • How do you fix the ringer on the iPhone 4s?

    I have an iPhone 4s and the ringer is not working.  Works fine in my car with Bluetooth.  Checked all my settings, have the latest software... does anyone know how to fix this?