Showing results for 
Search instead for 
Did you mean: 

DAQmx continuous reads. determine highest value

I'm still a LabView rookie(so to say).  I've written several differential and RSE, DAQmx analog read and write VI's without issue.  However, I need some advice regarding my next VI.  I need an analog read to to occur for X(ms), then read the results to determine the highest voltage measured surning the sample period.  The sample period could be as long as 5 seconds.  The only output I need from the VI is the Max Voltage Measured during the specified sample period.  


The inputs are not the problem.  I just need some advice, guidance, or suggestions regarding how to obtain the desired output. Ex: Do I send the Read results to an array, then determine the highest value from the array?  


Any advice would be greatly appreciated.






0 Kudos
Message 1 of 5

Read the data as an array and then use Array Max & Min to get the maximum read value.

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
0 Kudos
Message 2 of 5

While array Min Max does seem to work( thanks by the way), I only get the data from the most recent Read iteration(basically the last second of run time).  I have to be able to pull the Min and Max for the entire run duration, possibly 5 seconds.   I made some changes to some Analog Read code I already had on hand(changed to contiuous sample, etc). Wrote the output to a graph and could see the realtime Read output just fine.  Changed output to Array Min Max, and only see the last iteration.   


I also tried modifying some NI Sample Code(Voltage_Continuous Read) with the Array Min Max.  Same result.


When finished, the code will be used in a test sequence to measure a voltage that is only present for 20ms max. A MODBUS write triggers the voltage output.  The problem is we dont know how long it's going to take for the write to occur to trigger the output.  Could be < 1sec, could be three seconds. So I need the VI to record samples from all iterations.


Thanks again. 



0 Kudos
Message 3 of 5

Store the max value in  a shift register.  Every iteration of the loop, use the Max Min function on the comparison palette with the output of the Array Max,Min and the shift register value to get the new max value and put that back into the shift register.

0 Kudos
Message 4 of 5

I think that'll work.  will work on it today and follow up.


By the way, I'm born and raised Maryland.  GO RAVENS!!!!



Message 5 of 5