MIN and MAX
Archiver
Posts: 46,084
Hey fellah's!
I'm looking to hook up an accelerometer to my stamp.
We're planning on some X and Y average readings as well as Peak readings.
Now, the average is no big deal...got that sorted.
However, I spotted the MIN and MAX funcitons and I KNOW they can help me
shorten some code to figure out peak values.
This is what I need to sort out....we'll be receiving data from the
accelerometer in the range of 1 to 250 (not binary!)....the accelerometer is
set to a 0.5mS period. So at a 2uS resolution (BS2 pulsin limit) I would
get 250 counts for a max pulse. great..no prob!
So when there is no movement horizontally (or vertically), the pulse duty
cycle is 50% (125 counts).
Now, what we're looking for is vibration...so we'll see things move back and
forth across this neutral area. We only want to see the largest value away
from this neutral number. So if one reading is 200 (positive direction --
just lets say!) and the next number was 10....we'd just want the 10 to be
outputted.
We're just testing a 100 cycles to sort out averages and peaks for that
time. So after 100 cycles everything resets and we start over.
Any further processing will be done at the receiving PC...but this all has
to be done on the stamp.
I did mess with the functions at 4pm friday at work....so not only did I
want to go home, but I was already tired. So maybe I'll have an epiphony
monday morning!
Cheers
sb
I'm looking to hook up an accelerometer to my stamp.
We're planning on some X and Y average readings as well as Peak readings.
Now, the average is no big deal...got that sorted.
However, I spotted the MIN and MAX funcitons and I KNOW they can help me
shorten some code to figure out peak values.
This is what I need to sort out....we'll be receiving data from the
accelerometer in the range of 1 to 250 (not binary!)....the accelerometer is
set to a 0.5mS period. So at a 2uS resolution (BS2 pulsin limit) I would
get 250 counts for a max pulse. great..no prob!
So when there is no movement horizontally (or vertically), the pulse duty
cycle is 50% (125 counts).
Now, what we're looking for is vibration...so we'll see things move back and
forth across this neutral area. We only want to see the largest value away
from this neutral number. So if one reading is 200 (positive direction --
just lets say!) and the next number was 10....we'd just want the 10 to be
outputted.
We're just testing a 100 cycles to sort out averages and peaks for that
time. So after 100 cycles everything resets and we start over.
Any further processing will be done at the receiving PC...but this all has
to be done on the stamp.
I did mess with the functions at 4pm friday at work....so not only did I
want to go home, but I was already tired. So maybe I'll have an epiphony
monday morning!
Cheers
sb