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.

Similar Messages

  • HT3529 how i use key board

    How i use key board specially  typing of upper case letter

    Press the shift key (looks like an up arrow).  Then press the letter you wish to type in upper case.

  • I want to play video on my computer to make some analysis to frames,the problem that I face ,I can't change video frame rate using labview,but I can change frame rate to the video out of labview using some program

    HI All
    I want to play video on my computer to make some analysis to it's frames,the problem that I face ,I can't change video frame rate using labview,but I can change frame rate to the video out of labview using some program .
    I used IMAQ AVI Read Frame VI
    for example I have avi video It's frame rate is 25 fbs ,my image processing code is very fast that can process more 25 fbs,so I want to accelerate video acquisition

    Hi abdelhady,
    I looked into this further, and reading an AVI file into LabVIEW faster than its frames per second won't be possible. LabVIEW could read in frames faster than 25fps, but because it will be pulling the available frame at that point in time this would just give you duplicate frames. If you want to be able to read in frames at faster than 25fps, you would need to speed up your AVI file before reading into LabVIEW.
    There's a good shipping example to show how to read in from an AVI file, "Read AVI File.vi". You'll notice that they add timing to make sure that the while loop runs at the right speed to match up with the frames per second of the file being read. This is to make sure you're not reading duplicate frames.
    Thank you,
    Emily C
    Applications Engineer
    National Instruments

  • Changing sample rate during acquisitio​n

    I need to programmatically change sample rate during acquisition: My application involves sampling at slow rate most of the time but during "region of interest" I need to change sampling rate to fast (close to max rate of board).

    I think it's also possible to use the same (high) sample rate during your
    complete acquisition, but in the case you need the 'slow' rate only take
    from the array sample 0, 10, 20 etc. or any number you prefer.
    In the end I think you want to make sure your computer doesn't have to work
    that hard all the way, or if you want to save the data, it's not that big...
    If I'm wrong, please tell me.
    Ron@ld
    Lancer schreef in berichtnieuws
    506500000008000000DF570000-1027480788000@exchange.​ni.com...
    > I need to programmatically change sample rate during acquisition: My
    > application involves sampling at slow rate most of the time but during
    > "region of interest" I need to change sampling rate to fast (close to
    > max rate of board).

  • 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

  • I have one application that has requirement to do low and high speed acquisition. I want to change sample rate while running. BUT... I have E series Device

    I am writing control software for a process that is usually dull and
    requires only 10 Hz acquisition rate.  At particular times during
    the sequence, however, we are interested in looking at a couple of
    channels at 1000 Hz.  My approach so far is to configure my
    Buffered DAQ to run at the higher rate at all times.  When we are
    in the 'high-speed DAQ' mode, the program logs every point to
    disk.  In the 'low-speed' mode, I am picking off every nth (in
    this case, 10th) point to log to disk.  At all times, I update my
    GUI indicators on the front panel at a maximum of 4 times per second (I
    find that anything faster results in an uncomfortable display), so I
    fill up a FIFO with data in my acquisition / logging loop, and read the
    FIFO in the display loop.  The data in my GUI display can be up to
    250 milliseconds off, but I find this acceptable . As a side note, I
    need buffered Daq with hardware timing, as software timing results in
    lost data at 1000 Hz.
    This all works fine and dandy, but I am convinced that it is not the
    most elegant solution in the world.  Has anyone developed a
    buffered DAQ loop where the scan rate can be adjusted during
    operation?  I would like to change the rate of the E-Series card
    rather than relying on down-sampling as I am now doing. 
    The reason I have concern is that at the moment I am simulating my AI
    using MAX and when running the down-sampling routine, I consistently
    miss a particular event on the simulated data becuase the event in
    question on the simulated data always occurs at the same 'time', and I
    always miss it.  Granted, while it is unlikely that my measured
    signal and my acquisition are perfectly synchronized in the real world,
    this particular situation points out the weakness in my approach.
    More than anything, I am looking for ideas from the community to see
    how other people have solved similar problems, and to have you guys
    either tear apart my approach or tell me it is 'ok'.  What do you
    think?
    Wes Ramm, Cyth UK
    CLD, CPLI

    Adding to Alan's answer:
    One of the problems that comes with these tricks for variable-rate acquisition is being able to match up sample data with the time that it was sampled. 
    If you weren't using either of E-series board's counters, there is a nifty solution to this!  You'll be using 1 of the counters to generate the variable-rate sampling clock.  You can then use the 2nd counter to perform a buffered period measurement on the output of the 1st counter.  This gives you a hw-timed measurement of every sampling interval.  You would need to keep track of a cumulative sum of these periods to generate a hw-accurate timestamp value for each sample.
    Note:  the very first buffered period measurement is the time from starting the 2nd counter until the first active edge from the 1st.  For your app, you should ignore it.
    -Kevin P.

  • Change Sample Rate On Recon3D

    How do you change the sample rate on the Recon3D from sy 48khz to 96khz?

    It should be available via Audio properties of Windows not in the Creative driver control panel.Unless you are using XP ,which doesnt allow it
    Right click sound icon -> Playback Devices -> choose your device -> Properties -> Advanced -> choose the sample rate.
    Default should be 48khz/24bits.

  • Changing sampling rate

    Hello,
    I need to change the sampling rate for a transient response test that I
    am running.  I am using cFP modules, and LabVIEW 7.1.  I am
    also using the data logger express VI and all of my channels are routed
    to that.  If I change my system clock to 250 ms, I can log data
    every 250 milliseconds.  Likewise for 200, 150, all the way down
    to around 30 milliseconds.  Below 30 milliseconds, the logger only
    logs data approximately every 30 milliseconds.  For my transient
    response data, I would like to be able to log data every 3-5
    milliseconds.  Any help is appreciated.
    Thanks,
    Derek

    Derek,
    I assume that you are using the FieldPoint express VI.  If so, I wrote a simple program to test the execution speed of this VI.  By getting a tick count right before and right after calling the FieldPoint express VI, I can calculate the time it took to execute the read.  With my tests, the read routinely executes and returns a value in less than 1 ms.  It may be that other code in your while loop is causing each iteration to take ~30 ms. 
    Please try running the attached code, and let us know if you have any trouble.
    Regards,
    Attachments:
    FP test.vi ‏100 KB

  • Can i use double buffering with SCAN_Sequence_Setup and sample rate divisors?

    If possible I would like to use double buffering when acquiring multiple channels at different rates using SCAN_Sequence_Setup. What are the tricks to sizing the buffers, if any.
    PCI-MIO-16Xe-10 and PCI-6052E are the boards I'm writing for, using Borland C++ builder under Windows2000
    Thanks,
    Brady

    Hello;
    At this time, you can't set up a multiple Scan Rate for different channels at same DAQ board. But, you can set up your Sample Rate to the fastest required to acquire you fastest channel, and then discard the readings of the other channels and only take the values for the different channels at their theoretical rate.
    Hope this helps.
    Filipe

  • Change sample rate on NI9477 on the fly

    I want to generate a continuous square wave on NI9477 and need to change the frequency of the square wave on the fly. Can this be done by changing the output sample rate? Are there any examples how it cane be done?

    E-team,
    You really can't change your generation rate of your card without stopping the task and then restarting it. However, you can do things like generate at a higher rate and vary the waveform you are generating to change the appearance of the signal. For Instance:
    Let's say you are generating at 1 kHz, and your waveform is 10101010, it would appear that you are generating a 500 Hz square wave. You could generate at 2 kHz and write 1100110011001100 and it would also appear as a 500 Hz square wave. Now, if you are generating at 2kHz and you have generated 1100110011001100 and you want to suddenly change the frequency of your output signal you can just start generating 1010101010 at the same 2kHz and it would now appear as though you have changed your output frequency, while in reality you have always been generating at 2 kHz.
    As for examples, you could look at a non-regeneration example, where you are always writing new samples to the DAQ card.
    Aaron W.
    National Instruments
    CLA, CTA and CPI

  • Changing sample rates for recorded audio?

    I've been trying to record VO through premiere. I'm using an m-audio mobile pre which has never given me trouble in any other application. When i turn on Meter Input(s) Only from the panel menu of the track mixer i can clearly see the input move in time and responsively. When I record however the resulting clip is much shorter than the ammount of time recorded and the audio is all garbled and chopped. It clearly jumps out to me as a sample rate problem. I looked at the clips and they are 44.1 but the sequence i'm recording to is 48. I made a 44.1 sequence and recorded to that which worked fine but there must be a way to change the recording sample rate right? I can't find a solution anywhere. Anybody know?

    i'm just following up here. Thanks for the replies. I understood i would lose data as one answer suggests, but i wanted to convert it so i could work in a new song environment in which all the NEW tracks were recorded at 192. So the second answer was very helpful. incidentally, with further research we are recording at 96.

  • Changing sample rate

    when I start to record a new project, sometimes it doesn't read any level coming in. Also, if it is responding, but then I try to change the sample rate before beginning to record, it also won't show any level. I'm using a MOTU 896.

    When you change your sample rate, you then have to relaunch the audio engine (go to Audio > Audio Hardware and Drivers, uncheck, and then recheck the "Enabled" box, and then choose "Try re-launch" from the following dialog).

  • Changing sample rate corrupted space designer.... somehow.... HELP!

    This is a new one to me, so it's very difficult to explain whats happened. I'll start from the beginning.
    I created a new, blank logic file with a sample rate of 96.
    I created a new software instrument and began to fill it out, adding some compression, some eq, and a little bit of reverb. The reverb came from space designer, using the small room preset "Thicken Vocals". So far so good. No problems, everything's working fine.
    I open Reason to rewire in (and ultimately track and record) some drum samples out of reason. The sound is coming out of reason into an aux bus in Logic, and that aux bus is being used as the input for a new audio track. I lay down some midi notes, play back the drum audio out of Reason and hit record on the audio track, essentially making an audio file of the drum samples coming out of logic.
    During this, something happens. Rewire is doing a LOT of work balancing the sync, the sample rate, etc.... and somehow, SOMETHING freaks out in the space designer i was using as some subtle reverb for my software instrument in logic (this software instrument is UNRELATED to the Reason audio).
    Now, when i hit play, the space designer just produces a loud, annoying pop. If I CHANGE the space designer preset, everything is cool. If i change it back to "Thicken Vocals" under small rooms.... POP.
    Worse, it seems to be a permanent problem.
    SO --- Ive done a LOT of trying to figure out whats going on. I create a new document and recreate the software instrument. I browse to Thicken Vocals... POP! I tried to replace the IR that "thicken vocals" is referencing by overwriting the file from a system backup I have (an IR called "0.03s_Room Vocals")... still no dice.
    Here's where it gets strange. It works FINE if the sample rate is 44.1... I can browse to "Thicken Vocals" and it loads up and init's fine, and everything is golden. As soon as I go to 96, or load it up when the document is set to 96, that's when it freaks out. NOW, if i adjust the falloff curves of the reverb just enough, THEN it suddenly works again, even under 96k.
    So, in a nutshell, at 96k, when I load "thicken vocals"... it almost appears (even according to the waveform Space designer draws) to misread the IR waveform, and it plays back as a POP. If I adjust the Falloff curve, it corrects itself, and the waveform even redraws! At 44.1, there are no problems.
    I did NOT have this problem before... does anyone have ANY clue what could be tweaking my system right now? I can post more details if I haven't posted enough... including pictures.
    THANKS!!
    Chris

    You might have a corrupted song file. Possibly your autoload as well. Try trashing logic prefs and rebuilding you autoload. Also, repair permissions and maybe even try updating the prebinding in the terminal. Another possibility could be a conflict with the driver of the Audiowerk8, unlikely, but possible.

  • Can't change sample rate for digital input on Mac Pro

    Hello all,
    on my Mac Pro with 10.4.10 I can't change the sample rate for the digital input. Whenever I choose 48000 or 96000 Hz it returns to 44100 Hz after a few seconds. Feeding a 24 bit/96000 Hz signal from an external ADC into the optical input doesn't help. No input signal is available for digital recording software such as Sound Studio or Cubase. After changing the sample rate in audio midi configuration to 96000 Hz the sound can be heard for a few seconds but when the setup returns to 44100 automatically the signal is, of course, lost.
    I've deleted all relevant preferences and restarted with resetting paramter RAM. Still the same. With external hardware such as M-Audio Firewire equipment setting the sample rates works properly.
    Thanks to all for helpful clues.

    Hi,
    when E&M signaling is configured on digital interface like the VWIC is, 2 or 4 wires operation is not applicable because there are no wires at all, and reported only for compatibility with the analog E&M card.
    Consequently, you cannot configure that and it will not make any difference to effect of the connection.
    Please rate post if it helps!

  • Intermitent Pops:  Changing sample rate doesn't help

    I am capturing to an aluminum powerbook using FCE 2.0.4 from a Canon zr45. I am capturing many hours of footage. I've started noticing every minute or so a loud pop on the audio. It is one frame long and it maxes out the audio levels. Using the suggestion from Apple Help, I switched the audio capture from 48 KHz to 32 KHz (the latter being possibly the original rate of recording). I still have the same intermitent pops on the audio (independent of the sample rate in simple setup). Does anyone have any suggestions of what I might do to fix this problem? Thanks very much in advance!
    Al Powerbook   Mac OS X (10.4.6)  

    Thank you very much for responding to my query.
    I think your questions have helped, if not solve the problem, at least pinpoint it.
    Yes, the pop appears at the same place each time. Yes it is on the quicktime file. And yes, it turns out it is on the original tape! Its faint and not noticeable on the camcorder speaker so I never noticed it before, but when I listened to the tape carefully at the point where it shows up on the FCE file I can hear it faintly on the tape now. I'm guessing it is electronic in nature, as the camcorder was tripod mounted always and the pop lasts for one frame. At least it wasn't a FCE issue. There might well be a way to automatically filter this using an audio filter.
    Thanks again!

Maybe you are looking for