From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FPGA: Highest value in a running window?

Solved!
Go to solution

Then I suggest you to not store the sample but the threshold comparison result in a single bit.

 

You'll need 2 u64 vectors. Convert them in boolean array and perform an AND operation over the array.

Cordialement / Regards

Patrice NOUVEL
Project Leader
CLD
0 Kudos
Message 11 of 15
(1,009 Views)

@ pnouvelize.

I like this idea.

But how to store the values? If you suggest an array, then how to update the oldest value with the newest sample?

 

Code.JPG

Best Regards

Alex E. Munkhaus
Certified LabVIEW Developer (CLD)
System Engineer
0 Kudos
Message 12 of 15
(994 Views)

You've already been given a mechanism to keep track of an index position.

 

1) Create a shift register

2) Increment it

3) See if it is equal to 100

4) Feed boolean into Select

5) If Select is true, output 0.  Otherwise, output the incremented value

6) Send output to shift register

 

This will rotate an int between 0 and 99 incrementally.

 

It also works the way Sam mentioned.  All you're doing with Sam's idea is keeping track of the last time you had a valid flag.  You can handle the last 100 points whenever you feel like it.  You don't have to process all of your data when you raise the flag.  You have two general ways to attack this:

 

1) Grab all 100 points of data and then analyze for a valid flag.

2) Grab each point and analyze it on the spot as a flag.  When you get the 100 points you want, handle your processing if flag is true.

 

His solution looks at the second way to do this.  It's likely more efficient than any other you're going to find.

0 Kudos
Message 13 of 15
(984 Views)
Solution
Accepted by topic author A.E.M

Here is the way I would do it :threshold_over_100_samples.png

Cordialement / Regards

Patrice NOUVEL
Project Leader
CLD
0 Kudos
Message 14 of 15
(979 Views)

Thanks for the suggestions!

 

Best Regards

Alex E. Munkhaus
Certified LabVIEW Developer (CLD)
System Engineer
0 Kudos
Message 15 of 15
(952 Views)