07-28-2009 10:19 AM
Hi All,
I have LV 8.6 basic.
I am aquiring a continuous analog voltage signal from an RPM transducer using a DAQ Asistant.
the display jumps around quite a bit and it could use some smoothing out. My thought is to average the data in sample groups.
The data type is dynamic coming from the assistant. I would like to try and average 10 to 20 samples them update the display so appears more stable.
I did search and look at many examples but I still stumped.
Any thoughts?
Mully
Solved! Go to Solution.
07-28-2009 12:16 PM
07-29-2009 07:52 AM
Hi Darin,
Thanks for the vi. I am new to programing so I'm still confused. I just want to output the mean value of a set number of voltage data points to a display set after set after set. This is much like the Average express .vi does in the profesional version of LV. Any thoughts?
Thanks in advance.
Mully
07-29-2009 08:10 AM
Hello,
Please see the basic averaging code screenshot I have attached. Where the DAQ assistant is located would be where your dynamic data goes in.
07-29-2009 09:59 AM
Hi Mark,
I built a .vi based on the picture you sent but it looks like 0 is added to the aquired data value and then devided by 1???
I would like to out put to a display the mean of every 10 data points aquired. I must be missing something??
Thanks
Mike
07-29-2009 11:06 AM
Hello,
The symbol that the 0 constant is wired to is a Shift Register. This initialises the first run of the loop to have 0 in the shift register. On successive runs, the value going into the adder is the previous adder result which is wired to the right side Shift Register, this is a method of feedback to the next iteration of a loop.
07-29-2009 12:50 PM
Hi,
I put a loop around your vi but it always passes 0 into the shift register and devides by 1 every time it loops ??? What do I have wrong?
07-30-2009 03:16 AM - edited 07-30-2009 03:17 AM
Hello,
Try my code, which is attached!
Notes: Replace the DAQ Assistant with your own, set to read a voltage on a channel of your choosing, with a finite (N Samples) number of samples (this is why I don't have a timer in my loop).
Make sure the samples to read is greater than 1, more like 1000 otherwise you won't have a valid average.
07-30-2009 07:43 AM
Hi Mark...................Thanks.
This seems to work.
So when the Daq assistant is set to "N samples" it takes that amount of samples and outputs them to the average code which updates the display each time the loop runs?
Do I have this correct??
Ps.
I have a vi that has multiple loops. I want to stop them all with one front panel button but I need to complete the "shut down code in the last block of a flat sequence structure before exiting.Here is what I have.
Any ideas??
thanks in advance!!
Mike
07-30-2009 07:48 AM
"So when the Daq assistant is set to "N samples" it takes that amount of samples and outputs them to the average code which updates the display each time the loop runs?"
Absolutely right.
As for your other question, try removing this from your sequence:
This is stopping your whole VI before the last frame of the sequence has a chance to execute. Your stop button will stop the while loop and let the next frame of the sequence execute.