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

Similar Messages

  • Digital sine waveform generation

    I am trying to use LabView to generate a digital sine wave with a NI USB-6259 and am not sure how.

    Hi
    To generate a sine wave coming out or your multifunction DAQ M-Series device (6259) it will be easiest using the "simulate signal" VI wired to a DAQ assistant.
    When you plug in your M-series DAQ device then you should be able to see it appear in the tree diagram on the left hand side of your measurement and automation (MAX) screen. This is where you can configure the hardware to the settings you would like and confirm it is connected correctly.
    On the block diagram in labview select express>>input>>simulate signal from the functions palette. This will bring up a configuration dialoge box to select your frequency, amplitude etc. Next place a DAQ assistant express VI on the block diagram, this can be found in the same menu as the simulate signal.
    This VI will also bring up some configuration boxes, you will need to select, generate signals, analog output, voltage. Next select your device which should be listed. This will bring you into a configuration screen so here you can set up just what you need. click ok and you will be left with two boxes, wire them together and run your program.
    You should now have a sine wave coming out of the outputs to your USB device so just wire to these.
    I hope this is OK, if you are looking for a more customizable task based program, what kind out outputs are you looking for and on how many channels?
    Best regards
    Graham Green
    Technical Marketing Engineer
    National instruments UK & Ireland

  • Generating arbitrary digital waveforms

    Hello,
    I'm new to the world of hardware-timed digital signals, so I'm unsure of how to proceed. I have a cDAQ-9174 and a NI 9474, which I'd like to use to produce two periodic, synchronized digital signals:
    What's a good way to accomplish this? I found the DAQmx "Generate Signals" -> "Digital Output" task, but that seems to only generate uniform pulse trains, not the arbitrary waveform I'm looking for.
    Thanks in advance.

    Ok, one step closer to the answer. DAQmx Write.vi (Digital Wfm 1Chan NSamp) lets me define an arbitrary waveform for 1 channel. How do I specify waveforms for two channels?

  • MyDAQ - Generating a digital signal and displaying it on an analog waveform graph

    Hi,
    I am using the NI MyDAQ to generate a digital waveform with an adjustable frequnecy. This is being implemented into a program I have already written which generates a TTL "like" pulse out of the sound card. I am displaying the output on an analog waveform graph, and I'd like to be able to display the digital waveform generated by the myDAQ on the same graph. (Not at the same time, either one or the other, toggled by a button). I've been messing with arrays and conversions but I cant seem to really get anywhere with it all.
    This is the vi I have made to generate the adjustable frequency digital signal with MyDAQ. Any suggestions on the proper way to do this if the following is wrong would be great too as I just got the MyDAQ a few days ago. I would think there must be a better way but this is the best I could come up with so far.
    Solved!
    Go to Solution.

    Hi Jonny,
    The general logic you are using to create a digital pulse train is fine. This VI you've written should work and will create the pulse train based on software timing (which is fine because you don't have hardware-timed DIO on the myDAQ anyway). However, it is usually good practice to start the DAQmx task just before your while loop and then clear the task after the while loop when you press stop.
    For reference, there are some pretty good LV examples that I recommend looking at for this application too. If you are just trying to create a digital pulse train, the example Gen Dig Pulse Train-Continuous.vi is a good example that uses a counter to create a digital pulse train of your desired frequency. This is generally the prefered method to create a pulse train if you have the hardware available to do so (the myDAQ does have a counter). Alternatively, there are some DIO examples that continuously write to a digital line/port.
    If you're not familiar, you can find the examples by going to Help >> Find Examples... in LV. Then, navigate to Hardware Input and Output >> DAQmx >> Generating Digital Pulses or Digital Generation.
    Also, here is some additional information about the myDAQ and its counters:
    myDAQ Counters 
    myDAQ Manual 
    Hopefully this helps.
    Chris G
    Applications Engineer
    National Instruments

  • I am trying to generate a 50kHz sine wave for ten cycles, then aquire this waveform and store it in a file, I am using a PCI-Mio 16E-4 board, has anyone done anything like this?

    I am trying to generate a 50kHz sine wave output on the DAQ card and then simultaneously recieve. I am using a PCI-Mio 16E-4 series board to do this. Has anyone done anything similar. I can generate a 50k wave no problem, and recieve one, but I can not get these vis to run together? Any suggestiosn

    Jrod, yes you should be able to do this, actually there are quite a few example programs come with LabVIEW that handles simultaneous analog input and output, I check the specs of the board you use, the board should be able to handle the sampling/generation rate, but make sure for 50KHz sine wave, you would sample at least twice as fast, preferably ten times the generation rate, then this puts the sampling of the board to thew limit.
    The program you can try is attached here, good luck with the application,
    XD Gao
    Applications Engineering,
    National Instruments
    Attachments:
    Simul_AIAO_Buffer(E-series).vi ‏104 KB

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

  • 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

  • How to generate multiple digital outputs (square waves delayed) at 50 kHz?

    I would like to generate 3 digital outputs like the picture attached at 50 kHz. Using the "digital pattern generator (marching values).vi", I can generate 3 digital square wave but without the delay time. How can I do that?
    I'm using the card PCI 6034E.
    Thank you
    Attachments:
    digital outputs delayed.png ‏8 KB

    Hi,
    the digital pattern generator (marching values) only shifts the binary value of the first signal and sample to the next signal/sample.
    Have you tried generating your waveforms via build waveform and use t0 terminal to change the lead delay?
    In general, this DAQmx example could be helpful which you can modify to your needs.
    DAQmx Write Digital Channel- External Clock: https://decibel.ni.com/content/docs/DOC-11142
    Regards,
    Thomas

  • 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

  • Using mathscript to generate multiple digital outputs for switch control

    Hello 
    I am new to this NI LV and a have kind of a basic question. I would like to use Mathscript to generate an array of bolean numbers which will be used to control the Digital I/O lines. I am using NI 6251 USB device and the Mathscript code runs well. But I have a problem using this array to control the Digital output. So I created a simple test programme where I set the DAQ assitant to generate 4 digital outputs(P0.0 ~ P0.3) and it gives error that  ".. number of channels in the data does not match the number of channels in the task..." (see attachment) . How can I solve this problem thank you.
    Attachments:
    K-9.jpg ‏36 KB

    looks like you did not initialize all 4 of the elements in the bool array....

  • Generating a tri state waveform pattern and writing into DAQ card

    Hi,
    I am using LV8.0 and NI-6259 DAQ card.
    I want to generate a waveform pattern which initially goes to +5v and goes to 0v and then again goes to -5v
    and finally goes to 0v. 
    I have used the waveform pattern generator and have generated 4 kinds of waveform with some particular samples
    and I will be appending all the 4 waveform patterns(+5, 0, -5, 0) and the appended waveform will be written into DAQ card.
    The problem is:
        When I probe CRO at the Analog output pin of the DAQ card, the pin level will be always at +5v and sometimes
        it goes to 0 and back to +5v. But I am expecting a waveform with 3 voltage levels i.e.., +5( some 100 samples), 0v(for some 1000 samples.
        -5v(same as +5v) and 0v( 2000 samples). 
    How to get this kind of waveforms in NI-6259 DAQ(M Series) card.
    Please find the attached VI which I have created.
    Letme know the loophole in the VI and correct way of generating a tristate waveform.
    Thanx in advance, 
     Yogesh
    Attachments:
    PWM_sample.vi ‏43 KB

    Hello YogeshaYS,
    Thanks for your post!
    I see that you are wanting to output a waveform that goes from 5 to 0 to -5 and then back to 0. It looks like from your code that you want to do this in a continuous fashion? If this is so you will need a while loop to output the waveform. Take a look at one of our shipping examples that shows how to do analog output waveform. Go to Help >> Find Examples. When here go to Hardware Input and Output >>  DAQmx >> Voltage >> Cont Gen Voltage Wfm-Int Clk.vi. Your VI works great but it only does the output once so that may be why you see some interesting results on your output. Let me know if any of this information helps you with your program. I was able to run it in a continuous mode and see the voltage levels go from 5 to 0 to -5 just like you were wanting. Have a great day YogeshaYS and please reply if you have any other questions on this. 
    Cheers!
    Corby_B
    http://www.ni.com/support 

  • Generating a sequence of waveforms with NI 5640R card

    Hello,
    I have a question regarding generating a sequence of waveforms. I want to use the example "NI 5640R analog input and output" (I know this example is capable of generating a QAM or single tone signal) and make changes such that the when i run the VI i want the output to be switching between single tone and QAM and i want this to happen until i stop the VI.
    And in the future i want to add another waveform (sawtooth) and want my output to be switching between the 3 waveforms. Any help regarding this will be grately appreciated.
    Thanks,
    Sandeep. 
    Sandeep Palreddy, Graduate Research Assistance
    The Microwave Remote Sensing Laboratory (MIRSL)
    University of Massachusetts
    151 Holdsworth Way
    Amherst MA 01003-9284

    Hello,
    I have a question regarding generating a sequence of waveforms. I want to use the example "NI 5640R analog input and output" (I know this example is capable of generating a QAM or single tone signal) and make changes such that the when i run the VI i want the output to be switching between single tone and QAM and i want this to happen until i stop the VI.
    And in the future i want to add another waveform (sawtooth) and want my output to be switching between the 3 waveforms. Any help regarding this will be grately appreciated.
    Thanks,
    Sandeep. 
    Sandeep Palreddy, Graduate Research Assistance
    The Microwave Remote Sensing Laboratory (MIRSL)
    University of Massachusetts
    151 Holdsworth Way
    Amherst MA 01003-9284

  • How to generate 3 phase sine wave to output on ELVIS

    Hi .I need to make a star or delta connected circuit on ELVIS board.2 make this circuit I need 3 wave generator( with 120 phase shift) and one common ground
    and because the ELVIS function generator can only generate one wave I decided to generate countionuos sine wave in Labview.
    Now I can generate 2 continuis sine wave in labview and output them on the analog outputs of ELVIS.Ao-0 and A0-1
    but I dont know what to do for the third signal.the elvis board just has 2 analouge output and when I use  Ao-0 and A0-1 I cant use ELVIS function generator after that.so would u please help me on this problem.how can I output 3 contious sine wave in Elvis.I have attached my VI to this post
    Attachments:
    new.vi ‏38 KB

    Hi, I am also having some problem in generating two signals from two AO. Could you please tell me how to generate two different signals from two AO. I have attached vi which generate square wave from one AO 0. I need the inverted signal in AO 1. 
    Attachments:
    Pulse Width Modulation.vi ‏48 KB

  • How to generating three phase sine wave simutiously with Vistual C++?

    Here I want to generate three phase sinewave at the same time with the phase angel 120 continiously. I can creat a task that contain 3 AOs, and generate 3 same sine wave at the same time. But I can not create 3 individual task which contains one AO channel, and write data to FIFO. Please tell me how to realize it?

    Hello, Rilee,
    Thank you very you very much. But I am still confused. The website I can not open. As you said, I shall create a data array to contain three phase data, for example, sinedata[750], sinedata[0:249] contains first AO, and sinedata[250:499] the second, and the rest is the third. then
    1. send the data for sinedata[0] to sinedata[249], to the board. with DAQmxWriteAnalogF64;
    2. send the data for sinedata[250] to sinedata[499], to the board. with DAQmxWriteAnalogF64;
    3. send the data for sinedata[500] to sinedata[749], to the board. with DAQmxWriteAnalogF64;
    and or so.
    Is all the above description right?
    Here I have several questions:
    1. When shall I send second section sample data? I think it shall be all the first data have been written to the board. And How can I know that all the first section data have been sent to the buffer?
    2. If I call DAQmxWriteAnalogF64 to write the second section data to buffer after the have finished first section data written, will this function affects the wave of the first section data?

  • Generate 3 digits floating point random number

    hai....How I want to generate 3 digits floating point random number??..plz help me...
    Thanks..

    Hi gdah,
    use some common math functions to get a randopm number in the range from 1 to 5 (but not including 5, see help for "random number"!)... Then format to a string (if needed) or set properties of numeric indicator...
    Hey Mike, your first version looked quite different
    Message Edited by GerdW on 05-05-2008 09:39 AM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome
    Attachments:
    RND_1-5_3Digits.png ‏1 KB

Maybe you are looking for