04-05-2011 08:16 PM
Hi.
I am using an Agilent 33XXX function generator, connected to a pair of power supplies. I am using the device driver within labview to control the ARB. However, I dislike having to use the express vi (simulate arbitrary signal) and I wish to be able to input the desired function shape on the GUI of my labview program.
I wrote a bit of code (vi lib attached) to do this but it seems a very unelegant solution. Can anyone suggest some improvements to my code or an alternative method? My code only works for square, pulse type waveforms.
My code basically scans the input array for duplicate X cordinates (which are not permitted in the output waveform to the ARB). It then shifts the second duplicate in the x axis by adding the value of dt. The code then effectively resamples the function and generates a waveform.
I plan to add a more user friendly way of entering the initial coords (like in the NI express vi) as well as rescaling functions.
Can anyone suggest a better way of being able to input the desired waveform shape in coordinates, specifying the dt and then generating a waveform which can be sent to the ARB?
Best regards
John
04-05-2011 11:06 PM
Can you attach your VI's?
You attached a LabVIEW library file which is nothing more than a definition of what files belong to the library. It has no real code inside of it.
04-06-2011 02:04 AM
Sorry, I have now attached the vi's as a zip archive. Thanks. John
04-06-2011 05:33 AM
It would be nice to get the code to work for any function (as the express vi does), not just for square pulses. Can anyone help?
I tried to deconstruct the express vi but couldn't understand how it functions.
Thanks.
04-06-2011 02:21 PM
Just a thought, have you looked at using the Basic Function Generator.vi? You could use this to build up an arbitrary waveform, using beginning and ending coordinates, amplitude, and frequency (or period). It works well for the basic functions, like sine wave, triangle wave, square wave, etc.
Tom Brass
Certified LabVIEW Architect
Saint Bernard Engineering, Inc.
www.saintbernardengineering.com
04-07-2011 05:44 AM
Thanks for the reply. I have found the arbitrary waveform vi in signal generation. However, this does not seem to give me any control over the 'dt' value so that I cannot control how quickly the pulse ramps up. Increasing the frequency does not change the dt.
Any ideas on how to change this? I need the dt to be very small.
cheers
John
04-07-2011 09:39 AM
To change the ramp rate, you need to change 3 things in proportion to each other: the number of samples, the frequency, and the dt. For example, to increase the ramp rate by 10, in your example VI, change the number of samples to 1001 (i.e., multiply by 10), the frequency to 0.002 (divide by 10), and the dt to 0.01 (divide by 10).
The next logical step would be to change the inputs to something more intuitive, like samples/sec and total time, and then calculate the three values.
Hope that helps!
Tom Brass
Certified LabVIEW Architect
Saint Bernard Engineering, Inc.
www.saintbernardengineering.com
04-07-2011 10:10 AM
Nice one! I'll have a look at it tomorrow. Thanks. J