03-22-2010 08:22 AM
I want to create a waveform with LabVIEW 8.6 and output to oscilloscope via NI PCI-6221, but I don't know how to create.
So I would like to seek you advise and technical support, thank you. The waveform is attached for you reference.
Solved! Go to Solution.
03-22-2010 10:59 AM
Hi 855,
You could always use the squarewave generator vi. Not sure if it installed on all versions of Labview or is part of a toolkit. I wrote a little VI that might do the job for you, will attach:
You can run it in a while loop. It does not pause the application so you can run other tasks in the while loop without any delays. It runs like:
You just need to ensure that the while loop runs fast enough to provide the square wave you need. Im assuming that it will be running at a fast frequency. The vi has inputs for the low time and high time of the square wave. You can enter a value in Cycles, this will then add the low part of the crankshaft waveform for x amount of seconds, input by the 'Off period' input. The whole thing will then loop. This should be able to replicate the drawing you attached with a bit of playing around.
How will you be sending this signal out? you will most probably need to add an interlock to ensure that you only send the data out once per change. This vi constantly outputs a value per iteration, so it can be used with a waveform chart. If you are actually sending a pulse out of a computer you will want to catch the change in value and then just send this once, rather then transmitting every iteration. If this is what you are after and you are stuck on doing it i can modify the vi for you, no probs. Cant garauntee when though.
Have attached a folder, should have everything you need. Is in LV 2009 and LV 8.6
03-22-2010 11:04 AM
Hi Again,
Just thought, i should of added a bit of logic that said if you input 0 for number of cycles the square wave runs indefinately without adding the low period. If you do need to have a square wave without the low period just make the 'Off period' the same value as your 'Low Cycle', this will do the same.
Rgs,
Lucither
03-22-2010 11:12 AM - edited 03-22-2010 11:14 AM
You need the very known 60-2 or 36-1 signal. Having seen your jpg, I assume the first.
I would fill a 1D array Boolean (true/false) with 120 elements, 101000001010101010.....
Then programming->Array->rotate 1D-array.
Put this in a separate loop, you can adjust the frequency by timing it.
Maybe some waveform generations look better, but you will need a workaround to delete that 2 pulses,
needing a counter, case stucture,...
03-22-2010 11:33 AM
03-24-2010 01:10 PM
Dear Lucither
Thank you for your prompt reply and help. But my LaVIEW8.6 can't open version9.0's file.
My 8.6 just can open the file (Demo VI.vi). After opening the file that the program can't running and appear some error.
I am so sorry, I just a novice respect to LabVIEW. I don't know why the program can't running. The situation of error has been attached for your reference, could you help me again?
03-24-2010 06:30 PM - edited 03-24-2010 06:31 PM
Hi,
Have just taken a look and all appears to be good this end. I am just on my way out to work, will take a look at this tonight for you when i get back.
Lucither
05-05-2010 03:52 AM
Regards
Kin
05-05-2010 07:36 AM - edited 05-05-2010 07:38 AM
Hi 855,
Try this version
If it does not work again let me know and i will look into doing it another way.
Rgs,
Lucither
05-05-2010 08:02 AM
Hi 855,
You might also want to have a look at ST5's solution. He actually had a better idea of what you wanted as he knew what a crankshaft was. Mine was more generic, it allows you to build what you want but his is very specific to your cause. Seems a really neat way of doing it. If you need to alter the amplitude just add a multiply function to the integer comeing from the boolean to number function.
Rgs,
Lucither