06-23-2012 08:25 PM - edited 06-23-2012 08:26 PM
I have this simple motor driver program that communicates with a stepper motor controller. I need to now combine this vi with one that acquires a finite number of voltage data points. I found a finite voltage example that works with my daq (usb 6009). I was thinking another stacked sequence in a for-loop would work to record voltages, drive motor, record more voltages, etc. for a desired number of repeated times.
I would like to be able to view the voltages on the front panel as I am recording them. Is there a simple way to do this when requiring a finite number of voltages? I am using finite because I only need say 10 seconds of data at each motor position and setting the number of samples with rate is a simple way to set the timing.
The examples I have seen update the voltages using a while loop. If i do this then the while loop keeps going until the user stops it.
Thanks very much. The 2 vi's I am working with are attached.
BTW I am a mechanical engineering graduate student.
Solved! Go to Solution.
06-25-2012 01:51 PM - edited 06-25-2012 01:52 PM
The best programming option to take in your situtation will depend on how frequently you need to sample. For fast data acquisition, it isn't necessary to update the front panel for every point as the change will happen so quickly you will not be able to see it anyway. I have attached a couple of screenshots with a few comments that displays a couple of options.
The first uses hardware timed finite acquisition, much like you were considering. With finite acquisition, by default the DAQmx Read will only output when the full number of samples to be read are in the hardware buffer. However, you can specify fewer samples and place the read in a loop as I have done to update more often.
The second option uses software to time when a sample is taken. You'll see that it only gathers one sample each time the loop is executed and at the rate I specified with the 'Wait Until Next ms Multiple' timer.
I hope this will at least give you some direction!
06-25-2012 03:53 PM
Thanks very much. Couple questions:
What is the difference between using the waveform data type and the double data type? Right now this data is output as double and then converted automatically for use with the Write to Measurement File Express VI.
The top solution using finite samples will write to a spreadsheet file the full number of samples at the sample rate, both input to the sample clock, correct?
I have four differential analog channels, so I would need 4 different charts, or maybe just numeric indicators would suffice. Do you have a recommened front panel numeric display to use instead of a chart?
Thanks very much. Even though my program is running real-time display would be awesome.
06-26-2012 11:00 AM - edited 06-26-2012 11:00 AM
Check out this link on the waveform data type.
The Write to Measurement File Express VI will likely work as long as the sample rate and, consequentially, loop rate is not too high. This is because the Write to Measurement File, while convenient, contains quite a bit of overhead. If you want to display multiple channels, you can either merge the signals and display them on one chart, or use multiple. That will be up to you.
The best indicator to use will depend on what data you want to display. The waveform chart is going to be the most comprehensive, but since you are getting the samples back as an array of type double, you can array indicators, or pull points out of the array and use numeric indicators as well.