How do I control the sampling rate of a PCI-6602 counter

Labview version: 7.1
Processor: Pentium 4 1.8 GHz
Hello All,
I have two avalanche photo diodes connected to two counter entrances on a 6602 (ctr 0 and ctr 1).
As can be seen in the attached VI, I'm generating a signal on ctr2 and using that as an external clock for the counters.
My objective is to accurately read the counter values at a rate of ~100KHz (i.e. 0.01 ms between measurements) and to be able to control the rate via the front panel. This should be possible (80MHz timebase), however when I run the program it is only able to actually sample at ~5 ms intervals. Also I'm encountering error 200141 even though I set the rate in the counter to 1M, which should buffer enough.
What am I doing wrong? Any help would be greatly appreciated.
Thanks a lot,
Attachments:
FRET_ver_14.vi ‏456 KB

Hello Aadam,
After looking at your code, I would not use the DAQ assistants to implement this. The DAQ assistant are best to be used for simple acquistion and since you are looking to use more lower level properties of you card, I would suggest to move to use the lower level VIs. It will be easier to understand where the problem is occurring at and will run better than using the DAQ assistant.
I have done some initial research for you to implement this design. I have described each of them below and how they will assist you.
The first example I have found is the Change Counter Output Frequency While the Task is Running. In this example, it will show you how to change the frequency and duty cycle of a counter output frequency task. One thing to remember about these counters are that the frequency will not change until the period has finished. For example, if you changed the frequency in the middle of a period of frequency of 1 Hz, it has to complete the 1Hz period before changing it to the next frequency.
The next example I would investgate is in the NI Example Finder called Correlated Dig Write With Counter.vi. The NI Example Finder can be found in Help » Find Examples... This VI will explain how to use the counter as a clock for another task. You will need to combine the concepts of the first example with this to make sure that you can vary the sample clock.
Finally, in the NI Example Finder, there is an example how to count digital events with an external clock called Count Digital Events-Buffered-Continuous-Ext Clk.vi. With this example, I first suggest to add the counter task and make sure you can get the external clock to work. After this, I would then implement changing clock.
Jim St
National Instruments
RF Product Support Engineer

Similar Messages

  • Why cant I control the sample rate?

    I am sure there is a simple programming answer to this but I am drawing a blank. I would like to slow down my sample rate in the following block diagram, however changing the sample rate at my Sample Clock seems to have no effect. Any ideas? Thanks in advance for your help
    Solved!
    Go to Solution.

    NIquist wrote:
    How about a Timed Loop?  It's one of the main structures.  You can also just drop the Wait.vi (Timing Palette) in your current loop.
    I recommend the Wait (ms) function over a timed loop unless you specifically need the timed loop behavior.  I just learned today (looking up something related to a different thread): "Each timed structure on the block diagram creates and runs in its own execution system that contains a single thread, so no parallel tasks can occur."  In a regular while loop, tasks can run in parallel.

  • How can I change the sample rate (delta X)?

    Hi, I create vi which can measure resistance, it will record the data and write to a file.
    however, I want to change the sample rate which is delta x. is that anyway I can do?
    I have try to put a clock inside the loop, it does slow down the speed but not the sampling rate.
    Please help me!!
    Thank you!

    Hello Shan405,
    Adjusting the Reading Rate of a DMM
    As noted in the above DeveloperZone article, there are a lot of factors contributing to a reading rate of a DMM. 'Sampling rate' can only be configured in digitizer mode, which can only be achieved on the flex DMMs
    Using the NI PXI-407x DMM as an Isolated Digitizer
    Regards,
    Glenn

  • How do I control the sample you view from a published iBook?

    Sorry if this is in the wrong section but couldn't find a section on iBook publishing.
    I now have 17 children's illustrated books on the iBook library and they all look great on an iPad. The problem is the sample a potential viewer can download; it is just 2 pages. You get the cover and then the page showing the purchase link. I am getting quite a few sales now but imagine how many I am losing if you can't see a sample of the book.
    I contacted Lulu who publish them but they seem oblivious to a fix. They keep referring me back the the preview on their site but that is what you see on the web. I made an epub file with a few of the pages from the book and upoaded it but still, i get just the cover in the sample.
    This is really frustrating and no one seems to know how to fix it. Certainly seems to be nothing I can do at my end.
    Any ideas?
    Thanks in advance for any and all assistance.

    Sorry I do not have an answer, but I would like to see your books.  What is the title.  Splinters69 yields no search on iBooks.  I would love to learn more on how you published and if lulu was worth it

  • How can I figure out, (and control), the sampling rate of my IMAQ board using LabVIEW?

    My IMAQ board is sampling at a certain rate and I do not know what it is... how do I figure this out using labVIEW? Also, how can I make sure that it is not waiting any time at all for sampling i.e. it is not waiting for any wait time functions or any of them other things that cause the program to slow. The reason that I want to do this is because the Kodak Imaging board that I am using seems to be delivering at a much higher rate and no my graph there are major gaps between each sample according to the time plot (for instance it goes from 178280 to 178290 all the way by 10's to 178340. But when the program is running continuously it has gaps of like 355 or so miliseconds I guess.
    Maybe that is just the time that it takes for the program to refresh itself, I am not sure. where could I find where this missing information is going?
    Thanks much,
    Brian

    Brian,
    Your IMAQ card should be sampling at the same speed of the camera, as long as your camera isn't exceeding the cards limits.
    As for how many images you're acquiring in your program, it depends on how long it takes for you to finish one loop of your code. It sounds to me that you may have a lot of processing happening after each grab, therefore slowing down the system.
    Try to comment out your processing (maybe with a case structure set to false) and output only your acquired images. See if that makes a difference. You might also try running this on a faster computer.
    BB_Phil

  • How do i ensure my sampling rate is a constant and correct (@250Hz) when using AI Sample Channel vi

    I am running a VI that samples 2 channels using the AI Sample Channel vi within a for loop (executing equal to the number of samples i require), i then calculate the difference between the channels. Within the for loop i use a chart to displays this difference in realtime.
    On exiting the loop the data is converted to an array, which in turn i then convert to a waveform (using dT as 0.01 as an arbitary solution at the moment). The waveform is then compared to limits using the limit specs and limit testing vi's.
    There is also other code displaying graphs from the previous iterations of the VI.
    My question is how do i control the aquisition rat
    e so that i know that the AI Sample Channel vi is sampling my data at a set rate (250Hz)?
    I have tried to use some of the hardware timed exaples supplied by NI to no avail. They can't give me the single point output required within the initial for loop for the real-time display.
    Any solutions welcome!!

    How about buffered acquisition? You can let your DAQCard acquire the number of samples you require instead of doing it with a FOR loop. Using a FOR loop means that you are software timed, which may as well be untimed since it's about as deterministic as the weather in Florida.
    Look for the "Acquire N Scans.vi" example.
    If you want to do this the RIGHT way, use continuous acquisition. Start your acquisition and keep doing AI Read in a loop. Also include your porcessing and display functions in the loop. Just make sure your loop runs fast enough to keep up with your acquisition. At 250 Hz, you should have no problem.
    Dan Press
    www.primetest.com

  • How to use on board counter to change sample rate dynamically on pci-6134

    Hi,
    I am relatively new in LabView.
    I am making power quality measurement system and I need to vary the sampling rate of my pci-6134 dynamically (all channels simultaneously). What I need is to have a constant amount of samples in each period of measured signal (grid voltage), which changes slightly all the time. Therefore I will have to measure the voltage, find its exact frequency and then adjust the sampling rate of daq accordingly. I know that there will always be some delay, but I would rather like not to go into any predictive algorithms...
    I have found an information in the Forum that one of possible solutions is to use an onboard counter to change the sampling frequency but I have no idea how to make that. Can someone help me or possibly show an example? 
    Is there a simple way to solve that problem?
    Thanks in advance
    Andrzej

    At least at a glance, the code generally looks like it ought to work.  Two thoughts:
    1. Instead of getting into PFI3 vs PFI8 routing stuff, can't you just specify "Dev1/Ctr0InternalOutput" as the AI Sample Clock source?  (You may need to right-click the terminal to get at the menu that exposes the so-called "advanced terminals").
    2. Try writing both the freq AND duty cycle  properties when you want to update the freq.  Or try using the DAQmx Write vi instead of a property node.  My past experience suggests that writing only the freq property *should* still work, but writing both isn't hard to try and may turn out to help if the behavior of your version of DAQmx differs somehow.
    -Kevin P.
    P.S. Bonus 3rd thought.  I just went back to reread the thread more carefully, including your first screenshot.  I'm now thinking that maybe the hardware actually WAS behaving properly, and that you just weren't aware of it.   When you query the AI task for it's sampling rate, all the task can know is whatever rate you told it when you configured it outside the loop.  So even as you change the counter freq to change the actual hardware sampling rate on the fly, the AI task will continue to report its orig freq.  After all, how is *it* supposed to know?
           Try an experiment:   Set your original freq very low so that the AI task produces a timeout error without getting all the requested samples within the 10 sec timeout window.  Run and verify the timeout.  Then run again, but after 3-5 seconds set a new frequency that will produce all those samples in another 1 sec or less.  Verify that you get the samples rather than timing out.  That should demonstrate taht the counter freq change really *does* produce a change to the hardware sample rate, even though the task property node remains unaware.

  • Changing the Sampling rate

    Hi,
       May I know how do I change the sampling rate on a Thermocouple node dynamically through a VI on the host ? 
       I notice there is a Config node in the "Start" case where I can set the "Sample Interval Mode" to "Host Driven" but I do not know how to continue after that...
       Thank you very much !
    Regards,
    Xinke

    A user message is created by simply right-clicking on the node and selecting "Create User-Defined Variable."  Once you set it up, that variable will update over the network automatically.
    Once you've got that setup, you need to figure out how you are going to use that variable.  You should probably start here: The LabVIEW Wireless Sensor Network Module - Under the Hood
    Note: User-defined variables are only available in LabVIEW 2011 for WSN.
    Chris
    Certified LabVIEW Architect
    Certified TestStand Architect

  • ADjusting the sampling rate on a FIR filter?

    How do I adjust the sampling rate on a digital FIR filter? Thanks in advance.
    -David

    You should really start a new thread instead of posting to one that is 5 years old.
    To answer your question, it depends on your data. I don't use the DFD but with the filter functions in LabVIEW, if you pass a waveform data type to the function, then the waveform data type contains a dt value. So, set the DAQmx Read to return waveform data. If you are using low level filter functions where the input is a 1D DBL array, then the filter has to be configured. With the low level functions in LabVIEW, you use the various coefficients functions that have a sampling frequency input.

  • The sampling rate of FP-AI-110

    How can I change the sampling rate of cFP-AI-110 in Labview 8.5?
    And the filter settings of cFP-AI-110 (50,60 and 500Hz) is equal to the sampling rate?

    Hi!
       I've found this on cFP-AI-110 Operating Instructions, pag. 8:
       "The filter setting determines the rate at which the [c]FP-AI-110
       samples the inputs. The [c]FP-AI-110 resamples all of the channels
       at the same rate. If you set all of the channels to the 50 or 60 Hz
       filter, the [c]FP-AI-110 samples each channel every 1.470 s or
       every 1.230 s, respectively. If you set all of the channels to 500 Hz
       filters, the module samples each channel every 0.173 s. When you
       select different filter settings for different channels, use the
       following formula to determine the sampling rate.
       (number of channels with 50 Hz filter) ×184 ms +
       (number of channels with 60 Hz filter) ×154 ms +
       (number of channels with 500 Hz filter) × 21.6 ms =
       Update Rate"
    graziano

  • Can't figure out how to set my midi controler to control the sampler!

    I have a Korg Kontrol49 and I want to be able to control the sampler knobs and faders with the ones on my Korg. I have it connected threw USB. It works for the keys but I can not figure out how to program the rest of it. Any help would be great. I tried reading everything I could to get it to work but I cant. Please help!
    Thanks
    Mac Pro   Mac OS X (10.4.8)  

    Press Command-L. Touch the onscreen control. Twiddle your MIDI knob. Assignment learnt.
    Then go read the manual on Controller Assignments...

  • Sampling Rate- How do I check and adjust the sampling rate on my Laptop?

    For the purposes of matching the sampling rates on my laptop to my usb microphone, (recording in garageband) how do I find out what the sampling rates are on my 2009 macbook?  Many thanks!

    GarageBand '11: Set the audio resolution: http://support.apple.com/kb/PH1873

  • How to coerce the sampling rate??

    I think I found my problem with sampling rate.
    I'm using a PCI-5122 scope card, and in many of my aquisitions, I'm setting the sample rate to 40MS/s. Apparently, this is not a valid number and the scope reverts to 50 MS/s
    Later when I try to calculate cycles per second based on cycles per sample, I need the actual sample rate, and 40 MS/s ain't it.
    I'm trying to coerce sampling rate.
    please,.

    The digitizer coerces the sample rate because of how the sample clock is derrived from the Reference Clock.  The following information is on page 13 of the specifications:
    http://digital.ni.com/manuals.nsf/websearch/C6B059C1BDD70101862574C8005567F1
    The sample clock is created by dividing down the Reference clock (internal reference clock is 100MS/s) by decimation, and it divides it by N, which is an integer between 2 and 65530.  
    Thus 50MS/s uses a decimation factor of 2, and 33.3MS/s is the next valid sample rate with a decimation factor of 3.  So when you specify a sample rate that is not possible, the driver automatically coerces the requested sample rate up to the next valid rate.  You can obtain the actual sample rate used in an acquisition using the NI-SCOPE property "Actual Sample Rate", or the LabVIEW VI "niScope Sample Rate.vi".  Using this property, you can get the values you need for your calculations.
    I hope this helps!
    Nathan
    Product Support Engineer
    National Instruments

  • How to store the sampling rate into the header of the data file?

    I want to store the data parameters such as sampling rate to the data file. Now I am using the Write Labview Measurement File VI, the data is saved, but like the sampling rate this kind of parameter is not in the file. How can I store this parameter?

    If you want the sampling rate to appear in a different location of the header, then it and it's subVIs can be modified to write anyway you want. Right click on the Express VI and slect Open Front Panel. Then you have a VI that can be modified. If you want to use an unmodified Write LabVIEW Measurement File, you could use that, read the whole file back in with one of the file read functions, insert a string with the sampling rate and then write the whole thing back out again. It might be simpler though, to use Write Characters to File to create your own header and then use Write to Spreadsheet File to write the data. There is also the function Export Waveforms to Spreadsheet File on the Waveform>Waveform File I/O. This uses a slightly different format than a .lvm file. It too can be modified if you don't like the default header.

  • CS6 will not accept my condensed mic stating; 'the sampole rates of the audio input and output do not match.  Audio cannot be recorded until this is corrected.  Use the appropriate operating system or audio device control panel to adjust the sample rates

    !

    The first things we need to know in order to be able to help are what are your operating system and audio device?
    Also the FAQ Setting the Sample Rate in Windows Vista and 7 may help.

Maybe you are looking for