Generate sine waveform (myRio)

What is the best way to generate a 1khz sine signal on one of the analog outputs of the myRio device? I tried a timed loop and the Point by Point Sine Generation VI similar to the Electret Microphone demo or this post: http://forums.ni.com/t5/Academic-Hardware-Products-ELVIS/frequency-matching-problem-with-myrio/m-p/2... by Sammy_K. But the resolution is a problem. The frequency is not very accurate and with a dt of 100 uS and a 1Mhz Clock I only get 10 samples per period. A dt of 10 is too much load for the processor (the deivce does not respond anymore and needs to be restarted). Is there a better way of generating a 1khz sine output or do I need to do this within the FPGA somehow?
Solved!
Go to Solution.

Hey JulianR,
The thing to keep in mind is that each time you call the Analog Write express VI you write one data point to the analog output on the myRIO.  The rate at which data is output is determined by the rate at which you loop runs.  You can use a timed loop in LabVIEW to write analog output values at a relativly fixed loop rate and vary the value to generate a sine wave output.
I put together an example of doing just this (but using the value to set a PWM duty cycle rather than analog output) in this thread.  You'd basically need to replace the PWM express VI with the Analog Output Express VI.
Finally as Marc67 mentioned you could implement the sine wave output in LabVIEW FPGA which would give you more control and let you use faster output frequencies.  I'd start with the timed loop method and move to FPGA if you need faster output rates.
Let us know if you have more questions for us.
-Sam K
LabVIEW Hacker
Join / Follow the LabVIEW Hacker Group on google+

Similar Messages

  • Problem with generate sine 50 Hz

    I have a problem with generate sine voltage with freq 50 Hz.
    I form waveform with this frequency and sent in to the "AO Write" with update rate equal waveform lenght*frequency. And so I have a cycle of my program 20 ms, but I need a cylce 5 ms.
    How I can make it right?
    I forming my waveform "Basic Function Generator" with sampling Info equal my waveform lenght.
    Message Edited by Unk on 09-28-2005 02:36 PM

    The
    amplitude
    phase
    frequency
    of the signal are independent parameters.
    You can generate the relevant signal using Basic Function Generator VI, then supply this waveform to your AO operation (DAQmx write is polymorphic and allows you to use a waveform directly as the input - those guys at NI are clever )

  • To generate sine curve using sine pattern.vi

    I tried to generate sine wave to provide sine curve to the motor. I used sine pattern.vi and the vi located before the while loop. I could not put it inside 'while loop' to change the amplitude of the sine curve while the program runs. What do I have to make some changes in the program to provide different values in 'sine pattern.vi' while the program runs?
    Attachments:
    AO_command_sin_input_with_position_info.vi ‏165 KB

    Jae,
    Looking at your VI, it seems that what you want to do is update the sinewave generated on the fly. Try using the Point by Point functions to generate a sinewave, they will give your the most flexibility. I am attaching an example that generates a sinewave point by point. If you change the value of the frequency control, you will see that the frequency of the waveform will change on the fly.
    Attachments:
    Generate_Sinewave_PtByPt.vi ‏32 KB

  • Sine waveform to double indicator (not array)

    Hi!
    I am using the sine waveform.vi, and I get a waveform, as standard output. If I use "Get waveform components". I get a 1D array from "Y". . What I want is to use the current amplitude value of the sine waveform as a double data type. How is this possible? If I use an index array, I can get all the array components, but I don't see how that is going to solve my problem.
    Thanks for your help!
    Is my avatar the dog from the fraggle rock?

    Waveform is combination of DataArray, dt and timestamp usually. So as you use "get wfm component" you will get array of Y data. This is what expected also as waveform is not of single scalar value.
    But to see the last recent element in your array you can use index array function.If you know the number of element in your array. If you don't know then use Array size function to know size and substract one from it then put it as index of array to get last value inside your array.
    In my personal experience on any waveform one interest area are amplitude, phase, frequency and sampling info etc.. thease are details which you are using to generate.
    So please varify once again what you want..
    - HS

  • Devo generare una sine waveform con una certa fase iniziale ma che sia reentrant

    devo generare una sine waveform con una certa fase iniziale ma che sia reentrant, in quanto sto simulando una digital down conversion e genero per ogni simbolo la moltiplicazione dei campioni del simbolo trasmesso con un numero di campioni uguali di una sinusoide con una certa frequenza. Quindi per ogni simbolo devo far partire la sinusoide con la fase con cui ha terminato l'iterazione precedente. Inoltre, dato che sto simulando una 16 QAM ho la necessità di creare due portanti, una seno ed una coseno, entrambe rientranti, ma con fase iniziale sfasata di 90 ° tra loro. Però, il vi SineWaveform ignora la phase se il segnale di Reset è false, come nel mio caso.
    I have to generate a sine waveform with a initial phase but it has to be reentrant.Since I'm simulating a digital down-conversion, I have to multiply the samples of each symbol with an equal number of samples of a sine wave that has a fixed frequency. So, for each symbol I need that sine waveform starts with the phase with which ends the previous sine waveform( related to previous symbol). Also, since I am simulating a 16 QAM modulation,I need to create a sine and a cosine, but the initial phase of 90 ° out of phase with each other. My problem is that SineWaveform ignores phase if reset signal is false, as in my case.

    Ciao Paolo,
     scusami per il ritardo con cui ti rispondo, ma sono stato abbastanza impegnato. Ho dato un'occhiata al tuo codice, e così com'è strutturato la sine carrier waveform non aggiorna la fase iniziale ad ogni ciclo inquanto è sempre e comunque impostata a phase = 0. Ho implementato un semplice codice che, data una waveform in ingresso, ne ricostruisce la fase e ti restituisce quella dell'ultimo campione della sinusoide in ingresso. A questo punto ti suggerisco di introdurre uno shift register nel for loop. Inizializzandolo a 0 (all'esterno del ciclo), collegandolo all'input phase del Sine waveform generator.vi sei sicuro che ad ogni iterazione la sinusoide portante parte con fase iniziale uguale a quella dell'ultimo campione della sinusoide precedente.
    Quindi ricapitolando dovresti:
    1) Aggiungere uno shift register al for loop. inizializzato a 0;
    2) Collegare l'estremo sinistro dello shift register all'input phase del tuo waveform generator;
    3) Inserire il VI allegato a valle del waveform generator;
    4) Riportarti l'uscita del Last element phase reconstr.vi all'estremo destro dello shift register precedentemente inserito.
    Spero sia tutto abbastanza chiaro, sperando di aver correttamente interpretato le tue problematiche a riguardo.
    Saluti
    Attachments:
    Last element phase reconstr.vi ‏17 KB

  • Daqmx functions generate a waveform

    I need to use the daqmx functions to generate a waveform.  The waveform specifications...
    Square wave...min voltage 5V, max voltage 8V...50% duty cycle...2kHz frequency...run continuously.
    What daqmx functions do I need to use to generate this square wave?  If this has been covered in another thread, I apologize.
    Jeremy

    Hi jjsomer,
    There are a couple of example VI’s that you can use for that, you can go to the NI Example Finder » Hardware Input and Output » DAQmx » Analog Generation » Cont Gen Voltage Wfm-Int Clk.vi
    That VI will show you how to output a signal that could be sine wave, square wave of saw tooth wave. In order to set the parameters that you need, you can use the Square Waveform.vi instead, this can let you set an offset for the signal.
    I hope this will help you,
    Regards,
    steve.bm
    AE | NI

  • How can I tell if an arb is currently generating a waveform? (LabView 8.5)

    I have a VI which configures the load impedance of a 5421 arb card by changing the value of the property node "Load Impedance".
    This only works if the arb is not generating at the time of the call to the VI.
    I wish to be able to call the function when the arb is either generating, or not generating a waveform.
    Is there a way I can determine whether the arb is generating a waveform so that if necessary it can be aborted, then the Load Impedance changed, then the output re-initiated?
    Thanks
    Alan

    The fastest way to do this is to Disable the output (with enable output.vi) change the impedance and re-enable the output.
    Of course if you want to wait untill a generation session is complete you will need to configure the Done event to output something you can monitor (hardware only for unknown reasons) and use that to gate your changes.
    Jeff

  • Unable to generate sine wave

    Hello everyone!
    I am currently working on my Bachelor project at a company. i am stuck with a problem.
    I have designed a labview program for vibration test system. I have used cRIO 9076 as the controller with NI 9263(as D/A) and NI 9234(as A/D).
    The loop works as follows. the input is given from the labview program. it is then sent to the cRIO. the output of CRIO(that is output from NI 9263) is given to the amplifier. the vibration shaker vibrates based on the input from aamplifier. then the accelerometer detects the vibration and sends it to the NI 9234 and loop repeats iteratively. since i have designed a sweep sine vibration system, the output of cRIO is a square wave. it should be sine wave.
    the probelm is i am getting a square wave as output from my NI 9263 which should be a sine wave output. I have two subVI where i use nominal to binary convertor(for NI 9234) and binary to nominal (for NI 9263) as calibration mechanism. 
    the question is where have i went wrong? what should I do to get a sine wave? 
    PS: on searching NI i found out some formulas (to generate sine wave) and designed a FPGA and LabVIEW program to generate a simple sine wave and got a sine wave. if that formulas is to be included where should i include that?
    Thanks in advance.
    Regards,
    Vishal.

    Without seeing your current code, there is no way we can even uess as to why you are creating a square wave instead of a sine wave.

  • Generated Pulse waveform is distorted when I deliver the signal to the output port in the DAQmx

    Problem: Generated Pulse waveform is distorted when I deliver the signal to the output port in the DAQmx.
    Environment: Windows XP sp3 (32bit), Visual Studio 2010 sp1, NI-Measurement Studio 2010
    Device: NI - DAQmx PCI 6251
     Analog Input: 1.00MS/s multi-channel (aggregate)
     Analog Output: 2 Channel 2.00MS/s
    Reference Example: AO_ContGenVoltageWfm_IntClk / AI_ContAcqVoltageSamples_IntClk
    Generated Pulse:
    1) AO0 = Square Waveform /0-5V / 8KHz / 0.5㎲/sample / sample 50% Duty
    2) AO1 = Square Waveform /0-5V / 8KHz / 0.5㎲/sample / (Reverse Image)
    Description: I’d like to deliver the waveform stream satisfied with specified constraints to the 2 channel output port in the DAQmx. To verify accuracy of the generated waveform, I did an electrical wiring from the Analog output channel (2 channels) to the Analog Input channel (2 channels) in DAQmx. As a result of this experiment, I could get a result which has signal distortion. Since the waveform has to satisfy with both high frequency (8KHz) and very short moment interval time (△t = 0.5㎲/sample) between samples, I cannot handle some parameters of the function in the referenced VC++ example. Following formulas shows an approach to deliver the generate pulse waveform to output port satisfied with constraints.
    Analog Output Channel
     Frequency = 8,000 cycles/sec (constraint)
     Sample per Buffer = 2,000,000 = 2*106 samples/buffer
     Cycles per Buffer = 80,000 cycles/buffer
     Sample per Channel = 1,000,000 = 1*106 samples/channel
     Sample Rate  = Frequency * (Sample per Buffer / Cycle per Buffer)
                              = 8,000 * (2*106 / 80,000) = 2*106 samples / sec
     △t  = 1 sec / 2*106 samples / sec
               = 0.5 * 10-6 sec/sample (constraint)
     Buffer Cycle  = Sample Rate / Sample per Channel
                              = (2*106 samples / sec) / (1*106 samples/channel)
                              = 2 channel / sec
    Analog Input Channel
    Sample per Channel = 1,000,000 = 1*106 samples/channel
     Sample Rate  = 1 MS/s * (2 Channel) = 5 * 105 Samples / Sec
    Program Code
    AO_ContGenVoltageWfm_IntClk / AI_ContAcqVoltageSamples_IntClk (VC++ Example)
    Result: The proposed approach was implemented in the experiment environment (VS2010, MStudio2010). As shown in Figure 1, we could get the unsatisfied result. Although I intended to make a ‘square’ pulse wave, the result looks like ‘trapezoid’ pulse wave (Figure.1). However, there is other result which was undertaken with different parameter condition. It looks like the square shape not the trapezoid shape.
    Please let me know what the conditions make the problem of signal distortion. (AO0 = Green line / AO1 = Red line)
    [Figure. 1] Frequency 8000 Hz / Cycle per Buffer = 8000 Result
    [Figure. 2] Frequency 1000 Hz / Cycle per Buffer = 1000 Result
    Questions: Please let me know following questions.
    1) Is it possible to deliver the generated pulse wave satisfied with constraints (f= 8KHz), △t = 0.5㎲/sample) to the output port without distortion using PXI 6251?
    (Is it possible to solve the problem, if I use the LabView or MAX?)
    2) Are there some mistakes in the proposed approach? (H/W or S/W program)
    3) What is the meaning of the Cycle per Buffer?, It could effect to the result?

    Hi Brett Burger,
    Thanks for your reply. For your information, I have set the sampling rate as 10000 as for the sound format, I have set the bits per sample as 16 bit, the rate as 11025 and the sound quality as mono. I tried using your method by changing the sampling rate as 8K but still my program encounter the same problem.
    I wish to also create a button that is able to generate a preformatted report that contains VI documentation, data the VI returns, and report properties, such as the author, company, and number of pages only when I click on the button.  I have created this in my program, but I am not sure why is it not working. Can you help troubleshoot my program. Or do you have any samples to provide me. Hope to hear from you soon.
    Many thanks.
    Regards,
    min
    Attachments:
    Heart Sounds1.vi ‏971 KB

  • Can I generate sine and square waves with NI PCI-MIO-16XE-50 card??

    Can I generate sine and square waves with NI PCI-MIO-16XE-50 card??
    How Do I generate those signals?

    Hello;
    You certainly can do that. The way to go about that is to use one of the Analog Output channels your board have available.
    If you are using Labview to program the board, you can find good examples at Search Examples->I/O Interfaces->Data Acquisition->Analog Output->Multiple Point (buffered) Analog Output.
    If you are using other Software language to program the board, you can fing examples at C:\Program Files\National Instruments\NI-DAQ\example\VisualC\AO.
    Hope this helps.
    Filipe

  • How to dynamically adjust Frequency, Phase and Amplitude for a Generated Sine Wave in C/C++?

    Hi,
    I wonder if anybody know how to dynamically adjust Frequency, Phase and Amplitude for a Generated Sine Wave in C/C++? This is a part of my project: I need to dynamically generate a sine wave voltage signal by some calculation using the data from a simultaneous analog input and another signal.
    Your help will be appreciated so much!
    Marlon

    Hello Marlon,
    Here is an example of changing frequency and ampliude for an E-series device in Labwindows/CVI. The programming should be similar in C for your S-Series device. As is says on the linked webpage above, this process is going to be very processor intensive since you will continually be creating a buffer.
    Nicholas C
    National Instruments
    Applications Engineering

  • Generating a waveform using PXI-6534

    Hello,
    I am trying to write a VI to generate 3 waveforms using a PXI-6534. I am not familiar with how to do this in Labview really, so I was hoping I could get some help getting started with this. The 3 signals are a clock signal, data, and load enable. The clock has a frequency of 614.4KHz, and a data bit is sent on the falling edge of each clock pulse. After 48 data bits have been sent, the clock remains low while the load enable signal is pulsed low for one clock cycle. Unfortunately I do not have the waveform generation editor, are there any alternatives to this? If anyone could give me any suggestions or point me to any tutorials or examples it would be greatly appreciated.
    Thanks,
    Steve

    This you can do this.  I have used this exact card to continiously bit pattern from an array I streamed out a 500,000 sample stream out at 10MHZ and read back a 8MHz and parsed the data.  Look at the daqmx examples.  essentially you want to write the array to the buffer and set it up for ALLOW REGENERATION on the write property and Continious on the sample clock. Look at the following examples:
    Hardware IO>>daqmx>>digital generation>>Continious Write Dig Port-Ext Clk generation.
       this sounds like what you need, a continious digital pattern generation using an external clock.
    Also see the non regeneration example. you can change the pattern on the fly.
    I would not use traditional daq since is is very outdated and probably will not be supported in the future.  DAQMX is much better.
    Paul
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA

  • Generating the waveform

    Hi everyone
    Thanks to those who replied to my message. I am able to transfer the data from optical spectrum analyzer to labview. However, the data is in the form of 2 strings. One of the strings contains the values on the x-axis, ie., the wavelengths and the second string contains the instensity corresponding to the y-axis. How do I generate the waveform in Labview using these two strings?

    First, you need to find the delimiter (i.e. the seperator between data values). The delimiter is usually either tab, space, semicolon or comma. Once you know the delimiter, you can use the spreadsheet string to array function to transform the two strings into arrays of doubles. From there you can do whatever you'd like with them, such as bundle them and display them on an X-Y Graph. I've attached a quick example with space delimited strings. It's in LV
    Regards,
    Ryan K.
    Attachments:
    String Parsing.vi ‏22 KB

  • 20-second clip taking over an hour to generate audio waveform

    After trying to figure out where my "share" files were winding up, I realized they haven't even finished rendering.
    I've got one 20-second clip with audio.
    It's been in the "Generating Audio Waveform" stage for the last 90 minutes (or longer). There's no %-complete indicator, so I can't actually tell if any progress is being made.
    Does this seem reasonable?
    I'm wondering if I should just cancel all sharing operations and try again.
    Thanks.

    Where would I find that information?
    I went ahead and cancelled all of the rendering and sharing background tasks and started over with the Sharing, now it just says 0% and shows no progress or indication that background tasks are running. The "Generating Audio Waveform" isn't even a background task at this point, and it's been about 30 minutes.
    I just closed FCP and will see what happens if I reboot the entire system and try again.

  • Generating a digitized sine waveform

    Hi,
    I am trying to generate a digitized sine wave to feed into my 16 bit DAC. Basically, I am trying to create a sine wave that goes from 0 to 65535, with a frequency and amplitude that I can control.
    Any ideas how can I do it?
    Thanks!

    Thank you for your suggestion!
    Attached is what I have so far. I think it works. I digitized the sine wave, but my problem is that the sine wave is not "continuous/real time". Also I cannot change my sample size (default is 1000).
    Any other suggestions?
    I am planning of providing a digitized sine wave to a DAC and measuring SNR at the output of the DAC with an Audio Precision. That is why I needed a continuous/real time sine wave with more sample points.
    Thanks.
    Attachments:
    digital sine wave NI.vi ‏50 KB

Maybe you are looking for

  • Checking for an existing filename in a directory

    How does iFS know that a filename already existing in a directory? I need to capture the information when someone tries to copy a file to a directory before the file is stored in iFS. For example, if I copy a filename to a directory that already has

  • Create an output without the sql commands

    Hi, i have the following procedure: CREATE OR REPLACE PROCEDURE test IS BEGIN DBMS_OUTPUT.PUT_LINE('HI EVERYONE'); END test; SET serveroutput ON; SET pagesize 500 ; SET linesize 200 ; SET heading off ; SET echo off; spool test.html; exec test; spool

  • Html Editor in XML Form builder

    Hi,    I have created a FAQ in XML Form Builder and I am using html Editor in the form. I need to give link to some selected text by using "web link for selection" option form the html Editor and I tried but in the iview the text does not appear as l

  • Deactivate monitoring for a certain scenario

    Hello experts, we want to deactivate the monitoring for a certain scenario for security reasons. Is it possible to create a (sync) XI scenario without saving any message data on the XI-System? Best regards, David

  • A two machine cluster

    I found this tutorial and followed it. http://vimeo.com/1799266 Only problem is it doesn't work for me. My two machines are connected via ethernet. I've set up the qmaster system preferences as per video. Qmaster admin shows them up as twice as many