Find a maximum value from sets of RCTIME data
Hie..
I am interested to get a maximum value from a sets of 20 values of RCTIME data I·read from port and would like to display it·using debug command. I have tried to integrate my RCTIME data with the equation presented in Emesystem... but not able to make it work.
Please assist me.
Thanks
I am interested to get a maximum value from a sets of 20 values of RCTIME data I·read from port and would like to display it·using debug command. I have tried to integrate my RCTIME data with the equation presented in Emesystem... but not able to make it work.
Please assist me.
Thanks

Comments
I am not clear on how the data is being stored or used, but on the fly you can update the maximum value by using the line:
IF value > maxValue THEN maxValue = value
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
I'm designing a water turbidity meter. The meter is able to identify the capacity of clay in water with the range of 10mg/L. I am using a proposed design by emesystems under topic, "measuring the small voltage" and integrate it with light sensor "TSLB257" and the system work very well. However, when I debug my output on screen or through Stamp Plot Lite, the output data seems to be fluctuating all the time, so it is hard for me to tell what value of RCTIME is representing the turbidity level of water. So, I decided to take only the maximum value out of all my outputs to represent my actual reading. It is the same like in the Stamp Plot Lite, there is one part that is indicating maximum and minimum value throughout the entire graph shown. What I plan to do is to debug the maximum value from the first 50 output values.
Besides, experimentaly and statistically, I am not pretty sure my idea to use maximum RCTIME value from the entire data is accurate enough to represent the level of turbidity.
I have tried to use the method proposed under the chapter statistics, finding maximum value, but I do not know how to modify the program to fulfill my requirement.
Thanks so much for your assistance
DO resultMax = 0 ' initial maximum = zero FOR idx=1 to 50 RCTIME 0,1,result resultMax = result MIN resultMax NEXT DEBUG ? resultMax LOOPIt can also help to do a smoothing low pass filter...
' works only for RCTIME result<16384 DO FOR idx=1 to 50 RCTIME 0,1,result IF idx=1 THEN resultLP = result * 4 resultLP = resultLP */ 192 + result NEXT resultLP = resultLP/4 DEBUG ? resultLP LOOPor a straight out average...
' average of 50, assumes the first reading is representative resultDelta = 0 ' accumulator DO FOR idx=1 to 50 RCTIME 0,1,result IF idx=1 THEN resultAvg = result ' reference to first reading resultDelta = result - resultAvg + resultDelta ' accumulate difference from initial value NEXT resultAvg = resultAvg + (resultDelta/50) ' final adjustment DEBUG ? resultAvg LOOP▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com