Re: rotate bytes in array
Hi, Art
a good question to ask : do you need to store the 30 values for another purpose than calculate your mean value ???
because @ each measurement you could calculate:
new_meanval = (old_meanval*29 + last_measure) /30 ... which gives you the mean value over the 30 lasts measurements ! ( called "rolling average", if I'm right )
note here 32 measures would be best for dividing time ! so :
new_meanval = (old_meanval*31 + last_measure) >> 5 ...
I think Darrel posted a while ago a nice routine about that ...
I remember he also posted about a 48 level stack ... may be ideas to take there ...
Alain
Last edited by Acetronics2; - 15th March 2012 at 09:26.
************************************************** ***********************
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 " !!!
*****************************************
Bookmarks