12-07-2010 07:44 PM
I have spent a lot of time trying to tackle this problem and hope someone can offer a useful insight! I have attached the VI described here.
I am using Labview connected to a NI USB-6212 DAQ to create a voltage ramp, which drives a laser through its scan. The laser is pointed at a detector, and I simultaneously read in a signal from that detector using the same DAQ. Because the detector is illuminated by the laser, it shows the scan ramp. I would like to repeat this voltage scan and read-in indefinately. Much of this system is working. I have used the "RampPattern.vi" to create a sawtooth wave, which is output successfully to the DAQ. As expected, the input from the detector shows the same sawtooth pattern. However, I am having a lot of trouble managing and displaying the scanned sawtooth from the detector, which is currently read in as a waveform.
The challenge I can't seem to get around is manipulating or collecting the sawtooth in such a way that I can do two things:
1) Display the incoming sawtooth a 'tooth' at a time. Each sawtooth represents one laser scan, and I would like to see the incoming scan ramp as a single slope, not a series of sawtooths. Ideally,as each scan came in, it would replace the prior scan (as in the Labview 'graph'), so that the plot would show a motionless scan that would flicker up the input of the last scan.
2) Split the incoming sawtooth at each ramp into an ever-updating array that could be acted upon with the math functions, saved to a file, etc.
I have the feeling that this wouldn't even be a speedbump for an experienced user, but I have been hung up on it. Could I collect the incoming analog signal from the detector in chunks that are the length of each ramp? Could I trigger an event at each ramp that would split off the waveform into an array?
I am open to any suggestions! Thank you for the input and help,
Sam
Solved! Go to Solution.
12-08-2010 04:29 AM
Hello there,
I have just done something very similar for a project myself. I think your problem is you aren't synchronising your acquisition with your output..
If you look at the Example Finder, Hardware I & O>DAQmx>Synchronisation>Multifunction>Multifunction Synch AI-AO.Vi, this is a good starting point.
Also use the function generator.vi (you'll need to fiddle the parameters but you can get a nice ramp) instead of the Ramp.Vi one your using.
The F-Gen.Vi has a frequency input and 'sample info', what you want to do is set the frequency for your ramp/sawtooth, set the #s for the sample info cluster and the Fs comes from mutliplying the freq x #s.
then, lastly if you wire the Fs value to BOTH of the sample clock.vis in the example code this should work as required.. then you can start on the saving, manipulation stuff you need..
Ill try to put this into a screengrab/VI when i get a minute...
hope this helps...
12-08-2010 10:34 AM
12-08-2010 01:44 PM
I implemented the BasicFunctionGenerator.vi, and have sync'ed my inputs and outputs. It is working fine at producing sawtooth waveforms, and I have attached the new, modified VI. However, my original problem still exists:
How can I treat each wavelength separately so that I can display a single sawtooth, or perform math on an array that represents the input from a single sawtooth?
Thank you!
12-08-2010 03:55 PM
Problem solved!
The solution was to wire the "number of samples per channel" setting in the DAQMx Read VI. I set the 'number of samples per channel' to the number of points in each sawtooth scan (that is the same value as 'number of samples in waveform' used to generate the sawtooth in BasicFunctionGenerator.vi).
The DAQMx Read Analog VI now reads one sawtooth at a time. The Waveform Graph displays each sawtooth, one at a time, as captured. The output waveform also has the proper dimensions (the length of the scan) and I can perform math operations on each single scan.
Works great! I have posted the operational code.