AI/AO at different frequency

Hi,
As a newbie, I met a problem when I tried to input and output analog signal at different frequency.
I followed PID-control-Multichannel.vi to build a control program, so input/output can be synchronized. However, the project requires that the AI frequency to be ten times of the AO. I could rewrite the while loop to make the output value constant for 9 of 10 cycles. However, I believe there is more straight forward way to do it.
Could anybody provide an example?
Thank you in advance.
Sincerely yours
Ming 
Solved!
Go to Solution.

lmuri wrote:
Hi,
As a newbie, I met a problem when I tried to input and output analog signal at different frequency.
I followed PID-control-Multichannel.vi to build a control program, so input/output can be synchronized. However, the project requires that the AI frequency to be ten times of the AO. I could rewrite the while loop to make the output value constant for 9 of 10 cycles. However, I believe there is more straight forward way to do it.
Could anybody provide an example?
Thank you in advance.
Sincerely yours
Ming 
Hello Ming!
Thank you for using the NI Forums. You'll be glad to know that DAQmx allows I/O tasks such as these to be ran not only concurrently but also at different rates.
The problem with the solution you've devised is that this implementation will remove the delegation of the tasks down to the hardware level and your program would become software driven; this becomes problematic when running data acquisition tasks at very high speeds as you become limited to the output speed of your Operating System (OS).
You can co-ordinate your tasks to operate synchronously and perform output and acquisition at different rates by creating a task master. This generally means that you configure a task through DAQmx that maintains a clock frequency and you create tasks which use this clock frequency, or a division of it, to operate at their own individual frequency. This will ease not only the implementation of synchronous DAQmx tasks but also provide an entirely hardware driven solution to maximimse performance.
Through LabVIEW, if you go to Help > Find Examples to open the NI Example Finder. If you browse through Hardware Input and Output > DAQmx > Synchronization > Multi-Function > Multi-Function-Synch Dig Read Write With Counter.vi, you will find an example of how to configure a Counter as a task master to control the operation of both a Read and Write operation. (This example shows a digital implementation but may be easily replaced with analogue.)
By setting the counter rate to the maximum frequency that you will require for your task (In this case, the speed at which you want to output values) and applying it to the output task SampleClock, you will drive the output task clock with the Counter as the clock source. You can then use the Counter as the source for the SampleClock for the input task, however set the rate to whatever division of the driving frequency you want. In the case of your example, you can set the input rate to 0.1 times the Counter Frequency to acquire at a 10th of the rate.
If you wanted to acquire at the same rate but only retrieve values at the 10th of the speed, this same solution could be configured to instead produce a trigger to return a buffered acquisition. With a master clocking task, the opportunities are endless!
I hope that you find this helpful, and if you need any more clarifcation don't hesitate to let me know. Have fun with your DAQ!
Alex Thomas, University of Manchester School of EEE LabVIEW Ambassador (CLAD)

Similar Messages

  • 2 analog output channels with different frequencies

    Hi,
    hope that somebody can help me:
    I created two physical tasks, analog output channels.
    I should give signals (triangle signals) to a scanner. The problem ist that I need these triangle signals with two different frequencies.
    I can create the signal with each of the task, but not together. Can I solve this problem somehow?
    Ah, and of course the 2 tasks should start together...
    Thanks for your help!!
    Telly

    You didn't mention the type of device you're using, so I'll assume it's a standard MIO. A typical MIO only has one AO timing engine, so you'll have to create one task for both channels and use a single update rate for the task. You will have to make the output frequencies different by passing different data for both channels.
    For example, let's say your update rate is 1KHz. The data for channel 0 is 1000 data points of a single cycle of a triangle wave. The data for channel 1 is 1000 data point of two cycles of a triangle wave. When you run the task, you will get a 1Hz triangle wave on channel 0 and a 2Hz triangle wave on channel 1.
    Good luck,
    Joe

  • How to structure the DMA buffer for PXie 6341 DAQ card for analog output with different frequencies on each channel

    I'm using the MHDDK for analog out/in with the PXIe 6341 DAQ card.
    The examples, e.g. aoex5, show a single Timer  (outTimerHelper::loadUI method), but the example shows DMA data loaded with the same vector size.
    There is a comment in the outTimerHelper:rogramUpdateCount call which implies that different buffer sizes per channel can be used.
       (the comment is: Switching between different buffer sizes will not be used)
    Does anyone know what the format of the DMA buffer should be for data for multiple channels with different frequencies ?
    For example, say we want a0 with a 1Khz Sine wave and a1 with a 1.5Khz sine wave.  What does the DMA buffer look like ?
    With the same frequency for each channel, the data is interleaved, e.g.  (ao0#0, ao1#0; ao0#1, ao1#1, ...), but when the frequencies for each channel is different, what does the buffer look like ?

    Hello Kenstern,
    The data is always interleaved because each card only has a single timing engine for each subsystem.
    For AO you must specify the number of samples that AO will output. You also specify the number of channels. Because there is only one timing engine for AO, each AO will channel will get updated at the same time tick of the update clock. The data will be arranged interleaved exactly as the example shows because each AO channel needs data to output at each tick of the update clock. The data itself can change based on the frequency you want to output.
    kenstern wrote:
    For example, say we want a0 with a 1Khz Sine wave and a1 with a 1.5Khz sine wave.  What does the DMA buffer look like ?
    With the same frequency for each channel, the data is interleaved, e.g.  (ao0#0, ao1#0; ao0#1, ao1#1, ...), but when the frequencies for each channel is different, what does the buffer look like ?
    In your example, you need to come up with an update rate that works for both waveforms (1 KHz and 1.5 KHz sine waves). To get a good representation of a sine wave, you need to update more than 10x as fast as your fastest frequency...I would recommend 100x if possible.
    Update Frequency: 150 KHz
    Channels: 2
    Then you create buffers that include full cycles of each waveform you want to output based on the update frequency. These buffers must also be the same size.
    Buffer 1: Contains data for the 1 KHz sine wave, 300 points, 2 sine wave cycles
    Buffer 2: Contains data for the 1.5 KHz sine wave, 300 points, 3 sine wave cycles
    You then interleave them as before. When the data is run through the ADC, they are outputting different sine waves even though the AO channels are updating at the same rate.

  • Finite pulse train with different frequency

    Hello,
    I'm trying to modify the labview example "generate finite pulse train" to generate a finite pluse train with different frequencies. Each freq will run 400 pulses. The freqs are stored in an array, which is being fed into a for loop. Thus ramp up the freq each iteration. However the program only generate 400 pluse at first given freq. I'm fairly new to daqmx and not sure what is wrong. Anyone have some idea how to fix it?  
    Attachments:
    pulse train finite mod.vi ‏38 KB

    The best "fix" will depend a bit on the needs of your app.
    Is it ok to have a fraction of a second without any pulses each time you change frequencies?  If so, then there's a pretty simple solution:
    1. Outside the loop you'd create a DAQmx virtual channel and configure for Finite Sampling (# samples = 400) using DAQmx Timing.vi.  
    2. Inside the loop you'd chain together a DAQmx Channel property node where you set the pulse frequency property, then perform a DAQmx Start, a DAQmx "Wait for Task Complete", and a DAQmx Stop.
    3. So for each freq in your array, you'll program the counter for that frequency, start the generation of pulsetrains, and then stop the task after 400 pulses have been generated.
    If you must change frequency on-the-fly, producing *exactly* 400 pulses at each freq setpoint will be tricky, and maybe even impossible to do reliably.  Some techniques will get you closer than others though, so post back if you need to do this.
    -Kevin P.

  • Producer Consumer simultaneous operations at different frequencies

    My goal is to do two operations simultaneously.
    The desired end result is:
    1)      Produce an output signal which oscillates at a specified frequency (1 to 10 hz)(using DIO NI-9403). This signal will cause a solenoid to vibrate at different frequencies.
    2)      Monitor voltage on 3 lines in real-time (using analog input NI-9201). This will monitor system response to vibration.
    3)      Produce an output signal which oscillates at a different frequency from (1) – producing 1-second HI values 5 seconds apart. This will cause the system to “pulse”; system response will be monitored.
    4)      Have a front-panel user interface where: the signals in (2) can be monitored; frequency of (1) can be monitored and changed; and the output on (3) can be monitored and changed.
    My efforts so far have been to build a producer-consumer structure. This is my first time using this structure so I may be completely misunderstanding its use. Feel free to correct me if I’m way off target.
    The issue I have is the solenoid in the consumer loop (which handles item (1)) is not operating at the desired frequency. It is too slow. I used a 10ms timer for this loop, but instead it is operating about 1 cycle per second.
    There may be a much better way to approach this, or maybe my program only needs some minor tweaks. Either way, thanks in advance for your help.
    Attachments:
    ProdComsLoop Pulser 2-27-14.vi ‏65 KB

    Hi BradleyDDC,
    It seems from your program that you don't need a producer consumer loop. The only thing you are feeding from one loop to another can be put in one loop, I mean the simulator on button.
    The timer does not determine how fast the loop runs in real time. To get more precise timings, we recommend hardware timed operations as opposed to the software timed ones.
    Instead of using a digital output signal, you can use a counter output task, here is a knowledgebase, which has an example of what you may want.
    Paolo F.
    National Instruments
    Applications Engineer

  • Simultaneous AO generation at different frequencies

    Is it possible to run two sine waves simultaneously from the same board, at different frequencies?
    example:
    Dev0/ao0...sine wave with amplitude = 10, freq = 1
    Dev0/ao1...sine wave with amplitude = 1, freq 100
    thanks for any replies.
    dave

    why not just set up 2 sine waveforms at the different parameters and send it to the AO write:
    Creat Channel->Timing (use waveform)->AO Write (using array of waveforms)->Start
    LV 7 example attached (uses DAQmx).
    2006 Ultimate LabVIEW G-eek.
    Attachments:
    simusine.vi ‏71 KB

  • Consumer for different frequencies

    Hello,
    what is the proposed architecture for consumer that muxes multiple producers with different frequencies ?
    Example: DEV1 goes 100 Hz, DEV2 goes 50 Hz. You need to mux the data together in order to get 1 list to simplify programming further and boost searching performance and so on. The cluster contains DEV1,DEV2 , when there is no new DEV2 you keep the last value there.
    I am deciding between multi-queue and functionalglobal. The queues seem better option to me.
    Let me know your opinions. Thank you !

    Dear Bublina!
    You are correct, queues are generally a safer and more reliable way of transmitting data between loops.
    The way I would do it is to have one single queue for all the producers with two items stored in the queue: 1 enumerated type and 1 variant. The ENUM can tell the consumer from which producer loop the data is coming from, and the variant can contain all the data sent. You can store the latest values of DEV1 and DEV2 in a shift register, and overwrite the one that was sent.
    Please tell me what you think.
    Regards:
    Andrew Valko
    NI Hungary
    Andrew Valko
    National Instruments Hungary

  • How to merge to frequencies together and play it? I have a program that outputs two numbers everytime and those numbers in Hz. I want to merge those two different frequencies and play the sound.

    Hi there
    I have a program that reads from a table done in excel and finds two numbers from the table(they're different all the time). Those numbers are represented in Hz. What I want now is how to merge those two numbers as frequencies and output them and hear them from the speaker as audio. I also have the part of hearing them done but I can't figure out a way to have it connected so that it doesn't matter which numbers come up, it'll update it accordinaly. I appreciate any helpers.
    Thanks a lot

    Then I'm not sure what you're doing, or what your definition of "add" is. Here is the example I posted, with Signal 1 at 250 Hz and Signal 2 at 500 Hz:
    Message Edited by smercurio_fc on 01-15-2009 03:46 PM
    Attachments:
    add freqs.png ‏25 KB
    add freqs.vi ‏123 KB

  • How to plot 2 signal in the same graph but different frequency?

    Hi!!
    I have 2 sensor, motion and EMG.. I want to plot both of the signal (after processing) in the graph (real-time)..
    The frequency of motion sensor is 128 Hz and for EMG sensor 800 Hz..
    When I'm trying to plot (motion and emg) in the same graph, the signal from EMG (red line) not smoothly and very different with motion sensor..
    I'm trying to resample that signla but, it's not working..
    Can you help me?
    thank youu
    Attachments:
    graph.png ‏11 KB

    Akardo14 
    Yes, I trying to use merge signal before...  but signal from emg signal didn't appear in the graph (using merge signal figure)..
    I'm showing motion and emg signal in different graph, it's work..
    But I need to show both of signal in one graph to compare between motion and emg signals (fig1)
    Attachments:
    using merge signal.png ‏19 KB
    fig1.png ‏9 KB

  • Can I use an unlocked iphone 4s from USA in Spain? Does it gonna work with a different frequency?

    I want a iphone 4s unlocked. Can I buy it on the United States and use on Spain? I listened that the frequency is different on this countries, and that the phone may doesn't work. I want to know it.
    Thank you so much

    The iPhone 4S will certainly work in Spain, even if purchased in the US.  Keep in mind, however, that warranty service is limited to the country of purchase.  Youll have to send your phone to someone in the US to bring into Apple if your phone needs warranty service.
    In addition, there is VERY limited availbility of the unlocked iPhone 4S in US Apple stores, if they're even available at all.  At this point, they're really only available online directly from the Apple Store

  • Can I use two different frequencies on a roaming network?

    I have a roaming network with a first generation Airport Extreme (i.e., first square model), with a first generation Airport Express connected via cable to make up the roaming network.  This is for a detached office that is about 50 feet and several walls away.  It has worked wonderfully for years until recently. 
    I believe I am now experiencing some interference to the Express.  Basically once a week I have to unplug the Express, count to 10-15, and plug it back in.  Then all is well... for about another week.  Oddly, the Express light stays green (why if no internet??).  Interestingly when I had my iPhone with me (office is primarily used for my MBP), it could still see the Express' SSID.  However, like the MBP, its wifi "fan" icon is not able to show a signal.
    I have tried changing the channel to one that isn't being used by my neighbors, nor my Extreme.  For a while, I was also experiencing interference on the Extreme.  But that seems to have been resolved after I changed the channel on that unit.  I noticed that my all my neighbors run in 2.4Ghz.  So I'm wondering if I should buy a new Express that can run in 5Ghz. But that means I lose wifi connection to my iPhone.  I can live with that inconvenience in the detached office, but not in my home (i.e., where the Extreme is).
    So my question is: In my roaming network, can I have my Extreme run in 2.4Ghz (to allow iPhone wifi connection) and my Express in 5Ghz? 
    Side question:  I noticed in Airport Utility that my Extreme's frequency is updated (Manual Setup > Base Station > Options) is updated weekly.  Could that be somehow causing my Express to stop having a wifi signal and require the Express rebooting (i.e., unplugging)?

    So my question is: In my roaming network, can I have my Extreme run in 2.4Ghz (to allow iPhone wifi connection) and my Express in 5Ghz? 
    Yes
    Thanks.  Good to know!
    Update Frequency specifies how often the Express will check to see if any updates are available...which would have nothing to do with losing the Wi-Fi signal or other problem.
    Thx.  I feel like an idiot!
    Btw, two other questions, if I may:
    1. If there is no wifi signal, why would the Express light still be green?
    2. When there is interference, why would the Express need to be rebooted?  Why wouldn't it simply regain it's connection once the interference subsided?  The reason I as is that I have exprerienced interference with the Extreme before and there is no wifi signal.  After a minute or two, it would reestablish internet connectivity on its own (i.e., without me unplugging and re-plugging it).

  • Different Frequency Beeps/Sounds

    I want to be able to make sounds or beeps of a specified frequency and a specified duration. I can't seem to find out how to do this.
    All I have been able to find is java.awt.Toolkit.beep() which all it does is beep. I have also looked at the javax.sound.midi and java.sound.sampling packages but even if I opted to go that overly complicated route I still can't find any information that helps me enough where I could actually use those to do what I want.
    Anyone know a way to do this?

    This is about the coolest diversion I've ever had:
    import javax.sound.midi.*;
    * @author Ian Schneider
    public class Noise {
        public static void main(String[] args) throws Exception {
            java.io.InputStream in = System.in;
            Synthesizer synth = MidiSystem.getSynthesizer();
            synth.open();
            MidiChannel[] channels = synth.getChannels();
            Soundbank bank = synth.getDefaultSoundbank();           
            synth.loadAllInstruments(bank);
            Instrument instrs[] = synth.getLoadedInstruments();
            int b = 0;
            final int cnt = instrs.length;
            while ( (b = in.read()) >= 0) {
                int v = in.read();
                Patch p = instrs[in.read() % cnt].getPatch();
                channels[0].programChange(p.getBank(),p.getProgram());
                channels[0].noteOn(b/2,v/2);
                Thread.sleep(in.read() * 2);
                channels[0].noteOff(b/2);
            synth.close();
    }Examples:
    Hear what your memory sounds like:
    cat /dev/mem | java Noise
    Hear what some java classes sound like:
    find . -name \*.class | xargs cat | java Noise
    Enjoy

  • I used to have a vi "Beep+.vi" that was able to make a beep with different frequence/duration on WINDOWS 3.11. It worked with the systemspeaker (no soundcard). Is there a similar vi that works under WINDOWS NT?

    Kaba Gilgen AG
    Prüffeld
    Christian von Allmen
    Freiburgstrasse 34
    CH-3150 Schwarzenburg
    Switzerland
    tel: ++41 (0)31 734 43 02
    fax: ++41 (0)31 734 43 79
    mailto:[email protected]

    "Beep.vi" has not worked on my PC for as long as I can remember (First Win95 & now Win98). I decided to track the problem down. I started with the NI knowledge base article on the subject and looked into my "Sounds" control panel and found that I did not have a "Default sound" event at all! I checked another PC and it did have this event, so on that second PC I searched the registry, found where "default sound" existed in it and exported that section of the resistry. I then compared that exported section with the registry on the machine that did not have the event and determined the differences, created a ".reg" file to correct the machine and merged it into the registry. Now it too has a "Default Sounds" event and the "beep.vi" works.
    The "Add
    default Sounds.reg" file that did the job for me is attached
    Attachments:
    add_default_sound.reg ‏1 KB

  • Scaling Voltage to different sound frequency and decibels

    Hello:
    I am trying to figure out how to convert (voltage samples) to play different frequency of sounds (e.g., at 1 voltage have the play waveform.vi have a different pitch than another voltage let say 2 V). Additionally, I also want to configure the "Sound Output Set Volume" to change the volume of the output based on the voltage also. Any insights to these problems would be greatly appreciated.

    Not quite sure what you mean.  Sounds like you want one voltage to control both the frequency and the volume at the same time.  Do you mean two voltages?
    If that's the case, you need to define a function that will relate the input voltage to the output frequency, something like f = 4000*V  (for a five volt scale), and something similar to volume.  Do you have that or am I misunderstanding your question?
    -Matt Bradley
    ************ kudos always appreciated, but only when deserved **************************

  • Record and Playback performanc​e goes down at high frequency

    Hi,
    We're testing record and playback using USRP-2920( LV 2013sp1, NI-USRP 14)
    To test it, we downloaded record and playback example code.
    Signal source is a function generator outputting 6 MHz bandwidth 8 VSB modulation signal.
    USRP Rx parameters are center = variant / gain = 0 / IQ rate = 25MHz and Tx parameters are center = same as Rx center / gain = 0 / IQ rate = 25MHz
    The problem is... in low carrier frequency like 70MHz, quality of playback signal is great.
    But in high carrier freqency like 2.2GHz, SNR and signal power dropped significantly i.e. they tend to drop as carrier frequency goes high.
    And  the strange thing is as carrier frequency is increased, a small peak on the center is increased as well.
    Please check the attatched file to see the tendancy.
    So.. my question is why is this tendancy occures?(we tested another USRP and the result was same as before)
    and what should we do to reduce this effect?
    Regards,
    Youngmin
    Attachments:
    record and playback results.xls ‏469 KB

    Hi,
    I suggest a couple of things:
    NI USRP 2920 is a non-calibrated device. So setting a gain value of 0 at different frequencies could mean a different actual gain. So try increasing the Rx recording gain (on the USRP) in cases where you observe low SNR. Similarly Tx is not calibrated.
    Is the signal recording done with cables or over wireless medium ? You can try to eliminate any spurious signals if you use SMA cables while recording.
    I think the power at the center of the spectrum is the DC offset. You may refer to the DC Offset/LO leakage section in the best practices section here http://www.ni.com/white-paper/13881/en/
    Thanks.

Maybe you are looking for