Sample Rate & Timing

I'm using a DAQmx task to continuously acquire analogue data.
I have used Task.Timing.ConfigureSampleClock to specify a 'rate' of 1000 and a 'samplesPerChannel' of 1000. So, I expect to receive 1000 points of data every second and this is exactly what I seem to get in my AsyncCallback.
However, I want to also generate an array containing the elapsed time since start of capture. My plan was to start at zero and then increment values in my time array by Waveform.Timing.SampleInterval however I find that Waveform.Timing.SampleInterval is 0.00062 seconds - why is it not 0.001 seconds?
I then double-checked the task sample rate by using Task.Timing.SampleClockRate and this seems to be 1612.9... - why is it not the 1000 I set during my call to ConfigureSampleClock?
Any pointers would be appreciated.
TIA

Thanks, you're right - I was specifying a sample rate lower than was available for the module I was using (the NI9239). I actually was expecting an exception to be thrown if I attempted that.
So, to make sure I don't get into this situation again I can make sure I select from the supported sample rates of 50/1→31 kS/s for this particular module.
Would you know if there is a programmatic way of finding the available sample rates for all module types? Perhaps I can assume it will always be Maximum Sample Rate/1→31?
TIA

Similar Messages

  • How can I programmatically determine the capabilities of a card under NI-DAQmx (e.g. max sample rate, number of AI/AO/CTR channels, etc.

    Is there a DAQ_Get_Device_Info() equivalent for NIDAQmx? I need to iterate thru all the devices on my system, and build up a list of device capabilities. The system may include M-series and E-series cards.

    Attached is a program I've used in the past to determine number of AI channels. It could be easily modified to check for AO or digital or counter. Also, there is a ton of properties that you have access to (i.e. max sample rate, max/min voltage inputs, etc.) that are accessed as properties of the type of channel, or timing properties, as opposed to properties of the board. Check out the DAQmx C Reference Help (Usually at Start>>All Programs>>National Instruments>>NI-DAQ). Expand the NI-DAQmx C Properties, and look at the List of Channel Properties, and Timing Properties, etc.
    -Alan A.
    Attachments:
    Device_Info.vi ‏25 KB

  • Can't set sample rate 1609

    Hi,
    we've recently upgraded to LV 8.6 and DAQmx 8.7 and then got problem with the data aquisition that uses the DAQmx API. For example, we have a cDAQ-9172 and 9239 AI module. The device could be user configured and a typical configuration could be a continous acq, single sample in 10 Hz. After upgrading the error -200279 "Attempting to read samples that are no longer available ... has been overwritten" has come up soon after the task was started. It turned out that the property SampleClkRate is not affected by the value that is put into the DAQmx Timing.vi, unless it was set > 1612,9, if you set 10,100 or 1000 or whatever the sample rate will still be 1612,9 when you read from the timing property.
    So the buffer then of course becomes overflown, but the question is why there is a minimum sample rate like this? Earlier it was fine to set it an arbitray value and the acquistion would be in that rate.
    There are many solution to get around this (read faster etc.), but it strange that the behaviour of the code can change like this from a version to another...
    /Henrik
    Solved!
    Go to Solution.

    I see one flaw in your program, you have hardware timing and software timing in one loop. The loop is limited by the software wait. (I think this is on purpose for demonstration).
    I have looked at the manual for the 9239 and page 18 notices that hte minimum input rate is 1613kS/s
    So that is explained, the only problem is that the DAQmx timing VI does not return an error or warning when setting a too low rate.
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

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

  • Diadem sampling rate

    Hello!
    We are using Diadem Version 11.0 and the hardware cDAQ with the voltage measurement hardware NI9229/9239.
    I am trying to sample the voltage by at least 4khz, but I always get an error message that says that this rate isn't supplied by the hardware (the handbook says different things). I also changed in the options from windows timing to software timing or automatic timing, and also from hardware to software timing. Didn't work out. How can I maybe change the resolution to get a higher sampling rate?
    Please help me , thank you very much in advance

    Hi Lorenzo!
    The problem is the NI 9229/9239 cannot sample at 4KS/s. If you check the NI 9229/9239 data sheet , it is said in the fist page you must use a sampling rate (Fs)= (50KS/s) / n; where n=1, 2, 3... 31; so it is not posible to sample at 4KS/s.
    You can use sample rate (Fs)= 4,166 KS/s (using n=12); or you can use sample rate (Fs)= 3,846 KS/s (using n=13) but not Fs=4kS/s

  • NI-DAQmx frequency sampling rate

    Hi there!
    I'm working on setting up a data acquisition Labview VI, to measure different signals on a test rig.
    I'm using the NI-DAQmx assistance (the Express VI?) to continously measure analog signals (Variable current, voltage and temperatures). This is working just fine, and i can change the sampling rate by writing to the express VI. The idea is, that the user can change the sampling rate from around 1 to 500 Hz. 
    We do however have a sensor that transmittes digital signals (a frequency), and are using a NI-9423 module to "read" it. As this is a digital signal, another NI-DAQmx express VI is needed to handle it (that's ok), but so far we can't figure out how to alter the sampling rate - it's apperently locked at 1kHz. 
    Being that we want to merge the analog and digital signals to one array, we are recieving overflow errors from the "analog" DAQ, if it's not set at exactly 1kHz. 
    So, in short - is it possible to change the sampling rate of a DAQmx recieving frequencies? So that we to DAQ assistences have the same sampling rate?
    Help would be greatly appreciated!
    - Nicklas
    Attachments:
    DAQissue.PNG ‏64 KB

    Unlike voltage measurements, which tend to be (more or less) instantaneous, frequency measurements take a finite (and often variable) amount of time.
    If it is a slow signal then you measure the number of counts of your reference clock that occur in one period of your input signal. As your input signal varies in frequency, so does the measurement rate. If it is a fast signal, you can either measure how long it takes to get n cycles or your input (again variable) or you could count how many cycles of your input occur in a fixed time period.
    The NI help on frequency measurements describes three different ways you can configure a counter to measure frequency.
    The long and short of this is that generally counter measurements come at variable measurement rates which can be problematic to fit in with a fixed rate loggin system. If the measurement period is much smaller than your desired rate then you can wait and trigger a measurement at regular intervals. If not, you can let the counter run at its own rate, placing the latest result on a notifier, and in another loop just read the latest measurement from the notifier each time you want to record a result. Depending if you counter is running faster or slower than your desired logging rate you will end up with either missed samples or repeated samples. There are inherant timing inaccuracies in both approaches because, unlike analog measurements, the counter measurement is not made at 'that exact time, now!' but over a period of time which may be long or short compared to your logging rate.

  • How to improve sampling rates in mega samples spartan 3e board

     I am trying to acquire data in spartan 3e board in mega samples rate can you post me any examples for this purpose
    Solved!
    Go to Solution.

    If you're trying to get analog samples in that range, the issue that you're going to run into is that that sort of sampling rate is right at the bleeding edge of what you're asking for (it's a 2-channel @ 1.5Msps chip, the LTC1407A-1). If you actually want to capture at these rates, you're going to need to pull some interesting LV-foo using single-cycle timed loops in the FPGA diagram or drop some code down into an IPNode/CLIP Node, with outputs from those IP blocks hooked to the IO in a SCTL.
    Please let us know a bit more about your specific design.
    -Brad

  • Parallel port sample rate

    Hi,
    I`m desperately in need of your help.
    For my school project, I`m trying to write a labview code in order to acquire air pressure data by using 8-bit analog digital converter via parallel port. Although my signal frequency very low -100 Hz-I think  I experience sampling rate problem. I  want to put sample rate and frequency data in my code but  how can I put it in my code?I `m giving square waveform via function generator which I need to see it on my graph in Labview. But there is something wrong in my signal in waveform chart. You can see screenshot and code attached.  . Also there are some noises and amplitude is not stable . How can I fix this?
    Would you please have a look at to my code and tell me how can I set sample rate and frequency?
    Attachments:
    CAN1.VI ‏21 KB

    Hi LW-s
    There isn't really a way to set the sampling rate for these VIs. You will have to use software timing. The only way to do this is with 'wait' functions inside your loop. You can also implement some logic to smooth/adjust your waveforms.  For a square wave the logic is pretty simple. If the input value is above a threshold store it as the max and if it is below the threshold store it as the min. (See the example below). For sine waves this is a bit more difficult and if I were you I would probably try to implement some sort of averaging. 
    Best Regards,
    Chris J
    Message Edited by ChrisJ on 08-23-2005 05:31 PM
    Attachments:
    example.JPG ‏86 KB

  • Sample rate for digital sampling (cDAQ-9172 & NI 9401)

    Hi!
    I have a cDAQ-9172 with a NI 9401 C-series module (digital). I would like to sample the digital inputs with a sample rate of e.g. 400 kHz or 200 kHz. My problem is that I can only select a the 100kHzTimebase clock, and therefore only get a 100 kHz sample rate. The 20MHzTimebase clock is too fast, since it gives me a sample rate of 20 MHz). Is it possible to get a user defined sample rate of e.g. 200 kHz, by e.g. dividing down the 20MHzTimebase clock?
    Solved!
    Go to Solution.

    The cDAQ-9172 chassis does not have an internal timing engine for digital input however you can use one of the onboard counters to generate your clock.  Set your pulse train generation counter to be one of the internal counters, such as "cDAQ1/_ctr0" and your digital input sample clock source to be /cDAQ1/Ctr0InternalOutput". 

  • Logic Sputtering, CPU spiking horribly for no apparent reason, gives MIDI sync error even though the computer is set at the same sample rate.

    It's literally making it impossible for me to produce anything, after what seems an arbitrary amount of time in Logic my audio will begin to distort and I will get errors stating that my MIDI sample rates don't match, but they DO and it will spit out some seemingly random sample rate from nowhere. My CPU usage will spike and even my cursor will jitter across the screen until it stops stuttering. The audio problem seems to only be caused by Logic but will sometimes continue to occur in other applications after Logic is closed.
    How on earth do I fix this? It's making it impossible for me to work on remixes that I have to have finished soon, I have deadlines and I simply can't work in these conditions... the audio doesn't work.

    That sample rate error comes up when Logic gets out of sync internally, you will sometimes also see a MIDI/Audio sync error. MIDI timing is taken from the audio driver/sample rate, it's what enables MIDI to stay in sync with audio, when the audio/MIDI engines get out of whack these are the kind of errors that pop up. (there doesn't have to be any MIDI in the song)  Can be caused by bad drivers, interference from another running program, synchronization settings, bad or incompatible plugins!

  • Digital sample rate

    Is there a way to set the sampling rate for digital inputs?
    In am using an 6032E Daq board. I use two VI's: Port Config and Port Read, but there I cannot set the sampling rate.
    The only thing I found with rate is for handshaking.
    I still have an other question then: in the same VI, I want to read from an Analog input and from a Digital input. I already wrote that VI, and it runs, but is there something I must consider when reading from both analog and digital inputs at a time?

    You cannot set a sampling rate for digital operations on an E-eries DAQ board. The port is static, meaning that there is no timing circuitry controlling the port. It is updated or read by software command only.
    You configure the port once, but you must call port read each time you want read from the port, and port write each time you want to update the port.

  • Counter Problem at low sampling rate

    What I am trying to do is to count the input from the camera and generate the number of pulses depending on the delay and interval. At the rate of 33ms the program works perfectly but if the sampling rate is 150ms it generates 2 pulses at a time. Is there a better solution to my problem ? Am I doing anything wrong ? Is it a problem with the loop timing or acquisition timing? I have attached the program. What puzzles me is that it doesnt work if the rate is lower! Please HELP.
    Thanks 
    p.s. I am very new to LabView so please excuse my ignorance.
    Attachments:
    CoolSnap.vi ‏142 KB

    Hello sha33,
    Thank you for getting back to me with more information. After looking through your code once more, I believe I have found the issue. Since this application is timed entirely in software, it is based on how quickly your operating system can run the program, and thus cycle through loop iterations. Since you have no Timing VIs in the program, this loop is running as fast as possible. Now, in the 33 ms case, you are getting a TTL edge a lot faster, so the DAQ assistant is updating its count faster as well. Lets say hypothetically that your loop is iterating at 60 ms. This means that every time you run through the loop your DAQ assistant will read the updated count value, and since you are counting every 33 ms, your count value will have updated.
    Now let's look at your 150 ms TTL signal. This is significantly longer than the 33 ms signal in the previous case. Lets say hypothetically your loop is running on average at 60 ms again. This time, your edge will come in and the counter will increment, generating a pulse with the second DAQ assistant accordingly. Now your loop will run through again 60 ms later but your next edge on the 150 ms signal is still around 80-90 ms away. This means that your DAQ assistant will return the same count value as the last iteration, and once again a pulse will be generated.
    Obviously the numbers I used for the loop iteration timing are hypothetical and entirely dependent on the operating system and its resources (i.e. it will run slower with an MP3 or Movie playing in the background). My suggestion would be to use a timing VI such as Wait Until Next ms Multiple to clock your loops more consistently. The goal would be to make sure that your loop is repeating faster than your counter is updating. Alternatively, you could account for the possibility of no counter input in your overall application to prevent a false positive.
    Let me know if I can clarify any of the above information, or if you have any additional questions related to this issue.
    Regards,
    Chris Behnke
    Sr. RF Engineer
    High Frequency Measurements

  • How to know the sampling rate for NI6624?

    Dears,
    I am trying to measure a transient signal that is a time-vary counter train.  The target frequency is increased from 0 Hz to 50 Hz when the measurement time rises to 1 s from 0 s.  The NI 6624 card and the LabVIEW DAQmx have been adopted.  In the block diagram, the terminal of measurement method “Low Frequency with 1 Counter” is set in “DAQmx Create Channel (CI-Frequency).vi”, and the “Finite Samples” mode is chosen in “DAQmx Timing (Implicit).vi”.  Then the transient signal points (increasing-frequency points) will be got successfully within 1 s.  Now I have a question: how do I estimate the time step “dt” between these data points?  Knowing the default sampling rate of the card seems a better way to help me to define the "dt", and calculates the time stamp at each data point.  If the foregoing concept is true, how the internal sampling rate in NI6624 obtains?  Beside, for the transient counter signal, any way to get the time stamp of data points is also welcome.
    Thanks for anyone comment,
    Adan

    Adan,
    When selecting "Implicit" as the DAQmx Timing type, you are indicating
    that a data point will be taken for every measurement the counter
    performs. When you create a task of type "Low Frequency with 1
    Counter," the counter simply uses the card's internal timebase to
    measure the period between edges of your signal. It then takes this
    period measurement and converts it to a frequency. Therefore, the
    spacing between the samples you read out is simply the inverse of the
    subsequent frequency measurement sample.
    Hope this helps,
    Ryan Verret
    Product Marketing Engineer
    Signal Generators
    National Instruments

  • High sampling rate is not accurate

    Dear alls,
    Any one know why the time loop is not accurate at defined period at the RealTime Trace Viewer ? In figure of VI, I set the period for the time loop is 250 us, but when I analyze in Real time Trace Viewer, it shows the real period time about 676 us. That means my data acquisition will be sampled in wrong sampling rate.
    Could you give me some explane, please? And how can I solve this problem? I tested this code with MyRIO board.
    Best Regards,
    Kien 

    crossrulz wrote:
    Why do you have a wait in your timed loop?  The point of the Timed Loop is to state the loop rate.
     ??? Bigger problems than that!  Why do you have any timing other that the TASK timing? And really, The task timing is most likely the loop rate.
    Can you post your actual VI?  I suspect something else is happening here that we cannot see (configurations, channels used, etc).
    And a snip of the Task needs posting

  • Sample rate and data recording rate on NI Elvis

    I am currently working on a project that requires me to record my data at 1ms intervals or less. Currently the lowest timing interval I can record is at 10ms. If I change my wait timer to anything below 10 the recorded data in excel will skip time. For example instead of it starting at 1 ms and counting 2,3,4,5,6...,etc. It is skipping from 2,5,12,19,....,etc. So my question is if it is a limitation that I have reached on the NI Elvis or if it is possibly a problem with how I've created my LabVIEW code. My program from an operational stand point is working great, but it is my data recording that is causing me to not be able to move to my testing phase. Any help on this matter would be greatly appreciated.
    Other information that might be relevant:
    Operating System: Windows 7
    Processor: Intel(R) Xeon(R) CPU E31245 @ 3.00 GHz
    Memory: 12GB
    DirectX Version: 11
    Attachments:
    Count Digital(mod12).vi ‏76 KB

    Hi crashdx,
    So my immediate thought on this issue is that the code inside your primary while loop might be taking too long to process to achieve such a high sample rate. Especially when making calls into external applications (such as Excel) which can take a large amount of itme. 
    There is a very useful debugging tool called the Performance and Memory tool. If you aren't familiar with this tool, it will allow you to see how much memory the various chunks of your code are using and, more importantly here, how much time each subVI is taking to execute. Does the code inside your while loop take longer than 1ms to run? If so, then you will definitely see unwanted logging behavior and will need to change your approach. Would it be possible to collect more than a single sample at a time and perform calculations on a large number of samples at once before writing them to Excel in bigger chunks?
    I've included a link to the LabVIEW helpful detailing the Profile Performance and Memory tool.
    http://zone.ni.com/reference/en-XX/help/371361H-01/lvdialog/profile/
    I would first try and figure out how long it's taking your loop code to execute and go from there.
    I hope this helps!
    Andy C.
    Applications Engineer
    National Instruments

Maybe you are looking for