Maybe something like this?
If reading1 > reading2 then
diff = reading1 - reading2
else
diff = reading2 - reading1
endif
Then maybe set a flag to know which calc was used?
Maybe something like this?
If reading1 > reading2 then
diff = reading1 - reading2
else
diff = reading2 - reading1
endif
Then maybe set a flag to know which calc was used?
Dave
Always wear safety glasses while programming.
Hi, Martin
Assumingpressure will be read as i.e 1013.3 mb ( displayed number < 65536) ...
the difference between two measures will be < 32768 ... ( or you will feel really really really bad !!! )
sooo ...
the MSB of the difference will be 0 for positive difference and 1 for neg difference... add to that PBP offers the direct print of the value and sign : " SDEC Difference "
Alain
Last edited by Acetronics2; - 17th May 2010 at 13:29.
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
The sensor is a Bosch BMP085. The actual raw un-compensated pressure value at about 260m (where I live) is -24200 in SDEC. I'm not sure what the range of values is going to be yet, I need to work that out yet (from sea level to say 1000m).
I'll try out the SDEC Difference to see what it does too.
Thanks, that looks simple enough for a start tonight.
I'd like to take the difference value and average it too, before deciding if the change is big enough to use and not just sensor noise. To average the raw output of the sensor needs 32bit math I think, so this has got to be easier for me.
The difference should be smaller than a WORD so if you do the average of a couple you should not need 32 bit math. If it does over flow the WORD then I think that would be telling you that the difference is larger enough to... make a difference![]()
Dave
Always wear safety glasses while programming.
Dave
Always wear safety glasses while programming.
Bookmarks