03-14-2016 06:22 AM - edited 03-14-2016 06:24 AM
Hi, how do I get the highest value of data from the acquired data using ADXL345 accelerometer and LINX in LabVIEW?
I want the highest data to be shown using an indicator. However, the data being shown is always the last data acquired. My problem would be what if the highest data is somewhere at the beginning or in the middle of all acquired data? How can I display the highest data using an indicator?
Here's a look at my front panel, block diagram, and sample acquired data.
From the Front Panel, the Detected Fundamental Frequeny indicator displayed 0.1929 (amplitude) which is the last value. But looking at the Excel file, the highest data is the first data which is 0.2013. I want the highest to be displayed on the indicator not the last value. How do I do that?
Thank you!
Solved! Go to Solution.
03-14-2016 06:53 AM - edited 03-14-2016 06:54 AM
Use the 'max & min' function from the numeric palette with a shift register (or feedback node) - each time you read a value, compare it to the last value and write the new maximum value to a shift register/feedback node. You may need to think about where you want to initialise the shift register (e.g. for each loop?)
03-14-2016 10:09 AM
Hi, I attached my VI (without the max&min function).
What I tried was adding another For Loop for the "max & min" function but I am not getting the result I want because I am lost where I would wire my X and Y values for comparison.
03-14-2016 10:24 AM
Store your Max in a shift register. You may need a shift register on both of your loops to get the result you want.
03-14-2016 10:27 AM
I have given you an example of what you need to do - it doesn't matter whether you wire the new value or the old value to the X or Y - it will always return the maximum of the two values so the order doesn't matter. It would have been more useful if you had posted what you had tried with the max & min. You need to put a shift register on the inner for loop (like I did with my while loop). If you only want to show the maximum value for each iteration of the outer for loop, you'll need to initialise the shift register by wiring a 0 to its terminal on the left. An uninitialised shift register will remember the value from the last time it ran - which probably not what you want here.
03-14-2016 10:44 AM
Thanks Sam_Sharp! After you said I could initialize the shift register to 0, I did that and it is working. Thank you.
Here's what I did:
From the "Highest Detected Frequency" indicator the value displayed was 0.333334 and looking at the Excel file that value was the fourth value acquired and is also the highest amongst the other data.
Thank you! 🙂
03-14-2016 12:25 PM
Since you are not updating the highest frequency until the loop is complete, you could change the shift register to an indexing tunnel. then use the array min/max function to get the Minimum frequency, the max frequency, and the index of both.