LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get the highest value from the acquired data

Solved!
Go to solution

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.

 

 

Front Panel.png

 

Block Diagram.png

 

Sample Data.png 

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!

0 Kudos
Message 1 of 7
(6,177 Views)

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?)

 

Max&Min.png


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 2 of 7
(6,166 Views)

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.

0 Kudos
Message 3 of 7
(6,134 Views)

Store your Max in a shift register.  You may need a shift register on both of your loops to get the result you want.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 7
(6,123 Views)
Solution
Accepted by topic author JersonJose

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.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 5 of 7
(6,117 Views)

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:

 

Front Panel.png

 

Block Diagram.png

 

Sample Data.png

 

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! 🙂

0 Kudos
Message 6 of 7
(6,105 Views)

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.

 

LV.PNG




Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 7 of 7
(6,081 Views)