Recording Max value for READADC

Andrei IRL

Senior Member
Hello everyone.

I am at the very early stages of a new project that will involve the use of a strain gauge.

One thing i can not figure out at the moment.

Is it possible to have a routine that will do the following:

Read voltage using READADC command
In my case the voltage will be increasing as the load will go up on the strain gauge.
Then at some point the load will drop off.
Is it possible to record the largest value that READADC was reading before the load dropped off and READADC started to go down?

I can perform basic READADC monitoring but dont know if its possible to use it as above.

I intend to use the MAX READADC value as a reference once its established.

Many thanks in advance.
 

oracacle

Senior Member
yes it perfectly possible
Code:
 readadc 0,b0
 if b0>b1 then
   let b1 = b0
 end if
b1 will only update if b0 become greater than what is already stored in b1.
 

hippy

Technical Support
Staff member
Code:
ReadAdc ADC_PIN, b0
highestReading = highestReading Min b0
The 'min' operator, somewhat counter-intuitively, is also the 'highest of the two' operator.

Correspondingly 'max' gives a 'lowest of the two' result.
 
Top