using a loop when you want something to happen only once is kind of silly…
To generate just a single pulse/period of your signal you need to adjust the sampling info. Please read the help for the singal generation function - all the help on all those inputs…
The Help Window doesn't explain much. But if I'm not mistaken, sampling frequency is the frequency at which the wave is being sampled whereas the number of samples is simply...what it says. To generate a single cycle all I need to do is to set the sampling frequency really high and the number of samples as small as possible. Too much samples would construct the structure of the wave beyond a single cycle on the graph. Correct me if I'm wrong. Kudos if I get it right...joking.
To generate a single cycle all I need to do is to set the sampling frequency really high and the number of samples as small as possible.
Well, you're half way…
Simple math: #samples = period time * sampling frequency
> To generate a single cycle all I need to do is to set the sampling frequency really high and
> the number of samples as small as possible
> Correct me if I'm wrong. Kudos if I get it right...
You have the right idea, but an arbitrarily "high" sampling frequency is probably not the best solution.
The rule of thumb is to sample at 4 times the frequency of your signal.
But it depends on what you want to do with the resulting signal.
In the attached vi (LV 2013) you can play with the Sample Rate Multiplier and see the impact of different sample rates.
Note the Sample Rate Multiplier must be greater than or equal to 2 (this was set in the properties dialog).
I'm an Applications Engineer with NI and I've picked up stevem181's code and made a small change to it to make sure it only outputs one wave, whatever the sampling rate or frequency, I hope this helps.
I've added an event structure to wait for input from the user before outputting the sawtooth, one cycle at a time. To make sure it doesn't get stuck if the code is used as a subVI, I've configured it to output a cycle every two seconds if no input is detected.
This is one of those rare times when an express vi can help.
Playing with the rate, freq and # of samples and seeing the graphed signal can be valuable timesavers.
@VSenior The OP Posted in 2013.0 and likely cannot open the 2014 mod you uploaded
Thanks for the prompt, you're quite right, I posted in the wrong version of LabVIEW.
Here's the 2013 version...