Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Averaging 24-bit data over 16 Samples

Status
Not open for further replies.

dmccric

Junior Member level 2
Joined
Jan 14, 2010
Messages
23
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Great Britain
Activity points
1,483
Hi All,

I have designed a system to read the data from a Force Transducer (Load Cell) using the AD7730.
I read my data which is in 24-bit format and I need to average this data over 16 samples (or so).

Originally I used 16-bit (65535) and averaging this was easy as my processor is 32-bit but now I am
using 24-bit (16.7M). I need some techniques for this.

I did originally shift the bits down by 8-bits (noise data at this level) and then averaged the data but
I need to average all 24-bits.

There must be some techniques that I am not aware of.
 

Most people would solve the problem by utilizing a long int datatype of their C compiler and the fundamental arithmetic operations defined for it.
 

If I understand correctly you mean something like

(result1+result2+...result16)/16

you can get the same average using

R1=(result1+result2)/2

R1=(R1+result3)/2
.......
R1=(R1+result12)/2

instead of divide by two you can shift right one

Alex
 

you can get the same average using
Obviously, it's not the same average. The samples get different weights in your code, most likely unwanted.
 

If I understand correctly you mean something like

(result1+result2+...result16)/16

you can get the same average using

R1=(result1+result2)/2

R1=(R1+result3)/2
.......
R1=(R1+result12)/2

instead of divide by two you can shift right one

Alex

Dude, this is totally wrong.
 

Yes, the way I have described above was wrong.

dmccric, why can't you just add the twelve 24bit numbers and then divide them with 12?
the sum of twelve 24bit numbers can fit in 28bits so a 32bit variable wouldn't have a problem storing this value.

Alex
 

Also the sum of 16 24-Bit numbers fits into 32 bit...., but divide by 16 is much simpler (>> 4) than divide by 12.
 

Yes, the OP was talking for the average of 16 results and I have magically reduced that to 12 results...:oops:

Alex
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top