Ni5401 how to generate 4 cycles of a sine wave at a time

I'd like to generate 4 cycles of a 100kHz sine wave using a ni5401.  I'm currently able to generate a sinewave at 100kHz countinuously, but I need to stop after 4 cycles and then do some other processing and then restart another 4 cycles and then stop etc...  any help is appreciated

hi htch,
Unfortunately this isn't really the ideal application for a 5401. This application is something that could be accomplished fairly easily with an arbitrary waveform generator, or even a multifuction DAQ card, as long as it had a sample rate of at lease 2 MS/s. The 5401, however, is an arbitrary function generator, which means that it is meant to generate continuously, not a finite number of samples. 
What you could try to do is use software timing to exit the loop after a certain amount of time has elapsed. However, you must keep in mind that software timing is not as accurate as hardware timing, and you may not generate exactly the amount of samples that you expect. 
Regards,
Leah
National Instruments
Applications Engineer

Similar Messages

  • How can I generate a smooth continuous sine wave

    I am trying to build a single frequency active noise control system to
    control a tonal acoustic disturbance. In order to do this I need to be able to
    drive a set of loudspeakers with a single frequency waveform which will be
    continuously adapting at each sample.
    The control system will ideally be implemented to control low frequency
    tones, 700-1000Hz, and thus sampling rates of below about 4000Hz should be
    sufficient for the task.
    However, when trying to continuously generate a waveform at an update rate
    of 4000 updates/sec the resulting sine wave output from the DAQ card when
    observed on an oscilloscope looks very much like a digital signal (a sine
    wave containing large "steps" in the voltage), as if there
    has been no
    smoothing in the DAC. Playing this through a loudspeaker results in a very
    "buzzy" sound and not a single frequency tone. Only when the update rate
    is much higher >50000 updates/sec, does the signal start to sound like a
    single frequency tone.
    I would much rather be able to implement the control system at a sample
    rate of 4000Hz than >50000Hz. How do I therefore guarantee a smooth analog
    sine wave output at the lower sample rates? Is this a labview problem, or
    a hardware problem?

    Is this a labview problem, or
    a hardware problem?"
    Problem?
    Well it actually the nature of the beast. As a rough rule of thumb, the signal starts to become smooth when the update rate is at least 10X the highest frequency present in your signal.
    The human ear is amazing in its ability to detect (hear) higher frequency components. This is the buzz you hear.
    If you want to keep your update rate low, then you may be able to get away with a low pass filter on the output from your DAQ device. An appropriately size cap and resistor may be all you need.
    Ben
    Ben Rayner
    Certified LabVIEW Developer
    www.DSAutomation.com
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to measure time difference between zero crossing of a sine wave and rise time of a pulse on a same graph?

    I have a 50Hz sine wave and a pulse signal on a same graph. The phase difference between two is between 0-90 degrees.
    Now I need to calculate the time difference between (when the sine wave crosses zero volts) and (when the pulse rises). The frequency will stay approximately same for both signals.
    The application is for a three phase generator. In simple words, when the time difference between the zero-crossing of sine wave and the pulse rises increases, that means that the load on the generator has increases.
    I am a beginner user of LabView (version 9, 2009), maybe it is a very simple problem but I've been pulling my hair out for the last few days and coudln't figure anything out. Any help would be greatly appreciated. I am using DAQ USB-6008 to measure these voltages and pulse from the generator and a sensor
    I have attached a jpg (a graph that i just made with excel to explain). The time 't' is what I am trying to measure
    Cheers
    Awais 
    Message Edited by awais.h on 03-30-2010 11:20 PM
    Message Edited by awais.h on 03-30-2010 11:21 PM
    Solved!
    Go to Solution.

    Hi
    Thanks for the code but I'm afraid it won't work. Like you said the probability of choosing a value that is on both graphs may not happen. This is something that I would like the code to do automatically.
    But I did use the previous code posted and made some modifications to it and it seems to work perfectly. Now the next thing is to be able to get just that one value that tells you the first time difference.
    Here is what I get using that code.
    As you can see from the t Values. I only need the one that is highlighted. If there is a way to filter out the rest it would be great.
    I was thinking of a while loop and as soon as the value is higher than 3E-5 it would store the number and stop the loop, but I'm not too familiar with arrays in labview.
    Here is the the code modified.
    As you can see, it wasn't that big of a modification and it still is your code.
    I will keep trying.
    Thanks for the help
    Attachments:
    FinalShockSpeed.vi ‏55 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

  • How to generate a high freq square wave on NI-USB 62xx

    Hi,
    I am trying to generate a 50khz square wave with an AO channel on the NI-USB 6212 (rated at 250ks/s AO). I started with the Voltage - Continuous Output.vi example but when i go up toward 50khz square wave (100khz sample rate) the edges of the square wave become rounded. The slew rate for the card is 5V/us and my amplitude is just .5V so i feel like I'm doing something wrong with the task setup.
    I also tried setting continuous samples using the onboard clock for a source and then writing an array [1,-1] but that fails at anything higher than ~8khz. 
    What's the most efficienct/correct way to set up a task like this? Any help appreciated. Thanks.
    Matt

    Hello Matt,
    Right now, I think that shape of the signal that is being output is being controlled by the load on the AO. 
    If there is a very large impedance load attached between AO and ground, the RC time constant of the circuit is going to be very high.  This will result in a large amount of time required to charge and dissipate the voltage.  By increasing the frequency, the amount of time allotted for this is being reduced.  Potentially resulting in the waveform you are seeing.
    Can you please upload a picture of your waveform?
    Can you please try to reduce the load on the AO?  This can be done by disconnecting the current load and attaching a small resistor (50 Ohms should be good).  Does this result in the correct waveform?
    Regards,
    Thomas C.
    Applications Engineer
    National Instruments

  • How to generate random numbers of the same at each time of execution of thm

    dear friends
    i am facing a problem that the random numbers generated at time of each exectuion of the program are not the same, i want to generate the same random numbers every time time i run the program. i need your help. i am giving the code in c++ if anybody can help in providing the solution so that i get the same random numbers at every run of the program. waiting for your help
    wit regards
    jaya shankar
    #include<iostream.h>
    #include<stdio.h>
    #include<stdlib.h>
    #include<time.h>
    #include<math.h>
    class density
    int s[150][150],parent[150][150],i,j,l,n,loop;
    public:
    void bd(void);
    void css(void);
    void density :: bd(void)
    cout<<"ENTER THE POPULATION SIZE = ";
    cin>>n;
    cout<<"\nENTER THE NO.OF LOOPS = ";
    cin>>loop;
    for(i=0;i<n;i++)
    for(j=0;j<80;j++)
    s[j]=rand()%2;
    cout<<"s:"<<s[j];
    void density :: css(void)
    int a,b;
    float c;
    for(i=0;i<n;i=i+2)
    b=rand()%100;
    cout<<"random b="<<b;
    main()
    density d;
    d.bd();
    d.css();

    Do not randomize the random number interface when you start your application. When the random number interface is not randomized when starting you get the same sequence of numbers each and every time you use it.

  • How to generate long text of the message during run time?

    Hi guys,
    I have a question like in the subject. Someone could help me with that? I need to put some kind of log after transaction execution into message's long text, so that the short text displays only some short information and long text contains detailed description of the problem, but returned by program. And the log can be long, so it is not enough to put there only some parameter.
    Thanks and kind regards,
    Marcin

    Hi,
    Do you want to change the label of the parameter??
    Check this example..
    PARAMETERS: p_check AS CHECKBOX USER-COMMAND usr.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(15) v_text FOR FIELD p_land1.
    PARAMETERS: p_land1 TYPE t005-land1.
    SELECTION-SCREEN END OF LINE.
    AT SELECTION-SCREEN OUTPUT.
    IF p_check = 'X'.
    v_text = 'From country'.
    ELSE.
    v_text = 'To country'.
    ENDIF.
    Regards,
    Ramesh.

  • Generating a 6X Sine Wave using an absolute encoder

    How do I get an Analog Signal Generation Synchronized to six times the frequency of an absolute nine bit parallel encoders output with adjustable phase relation. I am using a PXI-6533, a PXI-6711 and have available a PXI-6070E.
    Now the long version of the problem. I have a 9-bit absolute encoder connected to a motor shaft (up to 420Hz). From the encoders 9-bit (0-511) parallel signal I need to create a synchronized 6X sine wave (up to 2500Hzwith an adjustable phase relation. Picture an electronic timing chain. For every cycle of the encoder, I need to produce six full sine wave cycles with a variable tuned phase shift. I have LabView 7 w/RT.
    I have tried to use the Update Clock (PFI5) to step through a buf
    fer but it seems to drop an update every so often. I also have tried to monitor the bit-0 line to determine freq. and scaled the update rate accordingly but the phase shifts all over the place. Does anyone have any ideas on the matter ? I would really appreciate it! Thanx….Phil

    Phil,
    Another different option to solve your application would be to use the new LabVIEW FPGA module and the 7831R reconfigurable I/O hardware. Using these tools you can configure the FPGA on the board to generate the sine wave based on the 9-bit parallel input. The most simple setup would be to have a lookup table in the FPGA that has a corresponding output value to each of the 512 possible input values. This 512 sample table would contain 6 cycles of a sine wave. Every time the parallel input changes the analog output value would be updated accordingly from the lookup table. This setup would also allow to easily add a phas
    e shift of the output by shifting the point in the lookup table you are reading by a known constant.
    Christian L
    NICS
    Christian Loew, CLA
    Principal Systems Engineer, National Instruments
    Please tip your answer providers with kudos.
    Any attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system,
    or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject
    to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense

  • How to count the number of cycles in sine wave

    Hi,
    I am new to Labview.  I have labview 8.2 version and my dataacquisition is NIDAQPAD6015.  I could write a program to generate a sine wave of desired frequency through simulate signal. My question is how do i measure the number of cycles for this sine wave as soon as I run the program. Hope my question  is clear.
    Ravi Mokirala

    To find the offset (which in this case is the Y value midpoint around which the sine wave is symetrical):
    Capture more than one cycle.  Find the min and max values.  Subtract Min from Max and divide by 2.  Then subtract this result from the Max value (or add the result to the Min value).  This is the offset.
    To count the number of cycles where the offset is unknown, just use the first data point value as a reference.  If the next data point is more positive, then count the number of times that the first data point is repeated and the next data point is more positive.  Of course with DBL data type, you probably would not get the exact same value as the first data point, so you need to use In Range with a very tiny limit.  It all depends on your signal amplitude, frequency, and sampling rate.
    Example:  Lets say your first data point value is 0.5 and the 2nd point is 0.55.  You need to look for another value that is between 0.48 and 0.52.  Then read the very next data point value.  If it is greater than the previous value, add one to the cycle count.  If it is less than, you are at half a cycle, do not add to the count.
    - tbob
    Inventor of the WORM Global

  • 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 do I generate a sequence of waveforms, like first a sine wave, then a square one, and say again a sine wave?"

    "Hello everyone, I hope someone can answer the following question. How do I generate a sequence of different waveforms, with different attributes?
    Like, i want to generate a sine wave for some time, then a square pulse of some width and then again a sine wave of some other time. Finally I want to repeat this sequence. I'll really appreciated it if I can get an answer soon. Thank you!

    From the previous comments I am assuming that your waveforms are arrays, rather than the waveform data type. I am also assuming that the sine waves on both sides of the square wave are the same signal.
    If so then I suggest a slightly different approach. 1. Generate your sine wave, rather than the empty array. The length should be the length of the entire end signal.
    2. Generate the square waveform. You can either generate it at the length you need, or you can generate a much larger square wave, and then use the Array Subset VI to get the portion you need. Which method you use depends how you want to implement the whole method.
    3. Use the Replace Array Subset VI to place the portion of the square wave at the location (index) of the original sine wave you ge
    nerated.
    The result of this method will be an array that starts with your sine wave, and then at the index you choose it will place the square wave of the length you want right into the signal, and then finish up with the sine wave for the rest of the signal.
    Evan Collier
    Application Engineering
    National Instruments

  • How to get a pulse output at the start of a sine wave which is the input?

    i am working on a comparator that generates a pulse for the positive cycle of a sine wave.but i want to get a pulse of shorter duration at the start of a sine wave (using labview) please suggest

    Hello;
    You can synchronize one of the general purpose counters your board have to the analog input operation. By doing that, you can have your analog input starting the counter operation which will generate the desired pulse. Moreover, you can even specify the delay and width of that pulse. For more information on how to synchronize DAQ operations you can refer to an Application Note named "Advanced Synchronization Techniques for Data Acquisition" which can be found at our web site.
    Hope this helps.
    Filipe

  • LabVIEW FPGA Sine Wave Generator Reset Input Behavior

    I would like to know what the output from the Sine Wave Generator express VI is while the reset input is true, and what happens to the output immediately after the reset input is set false.
    I need to generate a regular sequence of positive half-cycles of a sine wave, with an arbitrary delay between them that is not related to the actual frequency of the sine wave. So my plan is basically to periodically fire a trigger in the fpga software that resets a sine wave generator and directs its output to an analog output until the sine wave goes negative, at which point the analog output is set to 0 until the next trigger.
    Thanks

    Muchas gracias por responder steve.bm
    El problema que tengo es el siguiente, estoy desarrollando un proyecto en el cual uso los conversores DAC y ADC de la  tarjeta FPGA Spartan 3E para lo cual use como base el proyecto que esta subido por la NI que se encuentra en uno de los enlaces que me dejaste,( Lesson 8 - Linking Existing VHDL Code from WebPACK into LabVIEW FPGA) del mismo solo modifique para usar el ADC y el DAC mediante el cual adquiero una señal senosoidal y la tengo que reconstruir, el problema es que como uso un generador de señal de laboratorio al ingresar la frecuencia de muestreo para obtener una buena reconstruccion, la frecuencia se baja lo cual en el proyecto real no podra pasar ya que la frecuencia ya en proyecto final la adquiero de la red electrica publica pero ahora para pruebas estoy con un generador, la verdad no se que pasa porque tiene un retrazo la señal.....
    Te parece si te puedo dejar mi proyecto subido en enlace para que lo revices ??

  • Generate n sine waves and add them together

    Hi
    I'm new to Labview and I want to generate n number of sine waves and add them together to form one signal that can be out put through a DAQ card. Each successive wave frequency will be the multiple of a base wave all will be the same amplitude.
    This to me suggested a For loop with a sig generator  and a passback in it but when I tried this it threw an error because the dt were different.
    Any help will be appreciated.
    Thanks

    Show us what you did.
    LabVIEW Champion . Do more with less code and in less time .

  • How to create sine wave?

    How do you create a simple sine wave in Logic, and how do you change the frequency?
    Logic noob deluxe

    Try the Bitcrusher plugin.
    But, dude, I get the feeling that to indulge yourself in your noob-ism will wear very thin very quick, and if your next question is where the Bitcrusher is and where you have to click and then how you can use it and what the controls do and after that how you can record what it does, then it might happen that noone will bother to read anymore let alone reply.
    We can hold your hand only so far and ultimately you must decide on your own where to click, what to try and when to think.
    How about getting some 1:1 tuition to get you up and running ? It's infinitely easier for one person sitting next to you than for a bunch of folks scattered allover the globe which try to read your mind.
    Christian

Maybe you are looking for

  • Final cut express to idvd

    Hey guys, I have been having a problem with the picture quality of the DVD's I made with final cut. I export them to a "Quicktime movie" from the file menu; which is what Apple said to do. So I went to my local Apple store and had the guy in final cu

  • Cleaning up temporary tablespace

    Hi, I am facing a problem where temporary tablespace of the production database has grown to 23GB.The instance cannot be bounced and there is very little space left for the rest of the database.I want to free up the excess space.I know I can do it by

  • Which table stores the created work-flow event?

    Hello, When am executing FM of 'SWE_EVENT_CREATE' in my custom program, its executing with SY-SUBRC = 0, but, am not getting any email to my SAP inbox! 1) pls. let me know the reason? 2) Atleast how to know that (where to see, any table) an EVENT is

  • Strange Facebook Active Sessions from RIM

    Hey all, My girlfriend has shown me a screenshot of an active session on her facebook account. She uses a blackberry to access her Facebook however shes also in Cyprus. Lastnight she saw that there was an active session from Great Britian - I did a r

  • How to uninstall Office for Mac

    I installed Office for Mac using the wrong product key and need to uninstall it. How do I do that, and how do I not uninstall specific files that have been created already (e.g., word documents). Thanks