05-24-2013 09:40 PM
Hi,
I have a nice vi that measures voltage for a single strain gauge. Now, I want to add a couple more strain gauges, and collect the voltage of all 3 within a single execution of my WHILE loop.
I found an example on the forum that I tried to imitate in this attachment. Is the attached vi the best way to measure voltage of several strain gauges to use the date in a single execution of the WHILE loop?
Any advice on how to understand the RATE and SAMPLES PER CHANNEL is most welcome. It is still confusing to me...Not sure I understand which one is the buffer etc.
My goal is to collect a SINGLE VOLTAGE VALUE, as opposed to the array, as shown in the attachment. Is there a way to collect a single voltage value for each of three separate strain gauges and use all three voltage values in the same execution of the WHILE loop? Of course, I'd like the WHILE loop to execute as fast as possible, and I don't want any data stored in a buffer; I want to collect ONE value of voltage for each of the three strain gauges (for a total of 3 different voltage values), do some calculations using the 3 values, and then go collect 3 new ones as soon as the calculations are completed. I dont' want to be pulling "old" values from a buffer. How do I achieve this?
In the attached example, I am using an average of an array subset, but, the example I found seems to require an array output, as opposed to a single data point output. I suppose I could make the array with only one element??....I am confused... can you advise?
I am using cDAQ 9174 chassis with NI 9211 to collect voltage values.
Thanks!
Dave
05-25-2013 07:19 AM
I think something like this is what you really want.
You only want 1 sample at a time and you don't care about the samples that could have been taken between the loop iterations. So setup the task to be a single sample. Then on your read, just read 1 sample (Multiple Channels->Single Sample->1D dbl). You can then just use Array Index to get your individual channels.
05-27-2013 07:14 PM
Hi,
I tried this on cDAQ9174 using NI9211 but, I get no data in the front panel indicators. Instead, I get this error 200077
Property Node DAQmx Timing (arg 2) in DAQmx Timing (Sample Clock).vi:1->forum may 24 reply for voltage measurement.vi <append> <B>Property: </B>SampQuant.SampMode <B>Requested Value: </B>Hardware Timed Single Point <B>You Can Select: </B>Finite Samples, Continuous Samples
<B>Task Name: </B>_unnamedTask<4>
When I run the vi in Highlight execution mode, the error 200077 appears at both the Sample Clock and the DAQ Read vi...and the values are all 0.00.
I have tested my wiring using MAX and all three channels, ai0, ai1, and ai2 are working fine, reading voltage correctly, but the vi does not work...what do you think?
Thanks,
Dave
05-28-2013 08:03 AM
Ok, apparently that cDAQ doesn't do the Hardware Timed Single Point. Instead, set the task to be Finite Samples and put in 1 for the Number of Samples on the DAQmx Timing.
05-31-2013 05:56 PM
Hi,
Still a bit puzzling...I tried the Finite samples and set the rate on timing DAQ to "1" per your instruction, but, still fails to display voltage values. Nothing displays in the front panel indicators, and then, when I STOP the vi, I get error 200077, which seems to indicate that "2" is the minimum...very confusing to me.
forum may 24.vi<append> <B>Property: </B>SampQuant.SampPerChan
<B>Requested Value: </B>1
<B>Valid Values Begin with: </B>2
<B>Valid Values End with: </B>8589934590
<B>Device: </B>cDAQ1
<B>Task Name: </B>_unnamedTask<B>
When I put "2" in, it executes without error and displays voltage values in the front panel, but, the data rate is sooooo slooooooow.... what is taking up all the time? How can I get it to display something like 2-3 voltage values per second? It is REALLY slow...like one value per second or so....really slow. Changing the rate between 1 an 10000 seems not to matter. Do I need different hardware to get more voltage values per second, as I need them for a feedback loop? The NI 9411 should give 14/second, which is plenty for me.....but the displayed data on the front panel is far less than this.
Thanks
Dave
05-31-2013 06:00 PM
sorry for the typo....I am using NI 9211, not 9411.
06-03-2013 12:28 PM
Hi dav2010,
On the DAQmx Timing VI, I think you might want to change your sample mode to "Continuous Samples" with samples per channel set to 1. When using the "Continuous Samples" acquisition mode, the samples per channel input designates the buffer size. When using the "Finite Samples" acquisition mode, you are actually setting the number of samples to acquire, and it will not allow a single point in this mode.
I also noticed that you had the rate set to 50 [Hz], which is above the sampling rate of the 9211 (14 Hz max). If you want to update 2 or 3 times per second, you would want to set the rate to 2 or 3 Hz.
Hope this helps!
06-03-2013 08:55 PM
Thank you! That seems to have done the trick...the data aquisition appears to be faster, and the values are displaying...so, I will try to incorporate that into my larger vi!
Dave
07-24-2013 09:46 PM
Hi,
I have made some more progress in developing my vi, however, I am confused by something I am observing, using the settings, "1" for samples per channel, a rate of "2" and mode CONTINUOUS SAMPLES on the SAMPLE CLOCK. My goal with this is to measure read ONE single voltage value near the beginning of the execution of the WHILE loop. After that voltage value is available, there are some calculations and WAIT steps, and serial commands that are issued as a result of the voltage values, all of which consume execution time, maybe 100's of milliseconds. After the calculations and commands are done, at some time later, I would like to read the voltage value at that time, and then do the other calculations, WAIT steps, and commands etc. again. What I observe is that the voltage values shown on the FRONT PANEL indicator do not match the voltage values I am measuring independently with a DMM on the sensor. Instead, the voltage values on the FRONT PANEL indicator are old values relative to the values shown on the DMM. It is as if several values are being measured and put in a queue (buffer?) to be processed; they are then run through the WHILE loop, even though the true value of the voltage is much different by that time. I want to use the most recent true voltage value each time the WHILE loop executes.
After the voltage value reaches a certain threshold, the WAIT steps are no longer executed, and only the calculations are, which are all much faster. Once the loop is executing the faster sequence, then, I observe an avalanche of voltage values display on my FRONT PANEL indicator, and then, the voltage values shown on the FRONT PANEL appear to match up with those shown on my DMM, which is measuring the voltage values independently.
How do I configure the READ function so that there are no old voltage values? How can I get the most recent and most true value of the voltage available at the beginning of the WHILE loop execution? The attachments show the configuration of the voltage reading sequence; the AI voltage and SAMPLE CLOCK and START TASK(not shown) are all outside the WHILE loop, and the READ is inside the WHILE loop. Would it be better to set up three separate READ functions, instead of the single READ function coupled to the INDEX ARRAY functions?
The attached vi actually shows measurement of 3 sensor voltages, and I am using this as a template for my larger vi that contains all the other calculations, WAIT functions and serial commands etc. but, the question is the same.... how do I measure ONE voltage per sensor per loop iteration at the time I need it? In my larger vi, I am measuring 2 voltages, as indicated in the attached .jpg's.
Thanks,
Dave