HOWTO find X,Y,Z axis acceleration measuements with MMA7260Q on MC13213

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HOWTO find X,Y,Z axis acceleration measuements with MMA7260Q on MC13213

1,390 Views
Topoestivo
Contributor I
Hi people,

I've got a question for you.

What Ansi C function I've to use in an application for MC13213 to find out X, Y, Z axis acceleration measurements from MMA7260Q?

And what kind of data (double, int) and what (acceleration in g value or in m/s^2) does it returns?

I've tried do read Accelerometer.c example, but I've not really understood how to do these measurements..

I'm sure you can help me!!

P.S. Sorry for my poor english!




Message Edited by J2MEJediMaster on 2007-06-27 09:12 AM
Labels (1)
0 Kudos
Reply
1 Reply

625 Views
fgs_chuck
Contributor I
Topoestivo,

In the Accelerometer example, the function doAccelMeasurement() reads the XYZ measurements. The macros to setup these channels appear in MC13213XSRB.h.Please look in that file.

- Within the definition of ACCEL_INIT_MACRO, 'ATD1C=0xE1' sets the ATD result to return an 8-bit unsigned result instead of a 10-bit result. Thus, the result is read from ATD1RH.
- 'ATD1PE=0x1C' declares the analog pins are connected to bits 2, 3, and 4 of Port B.
- 'ATD1SC=2' initiates the A/D conversion on the analog channel connected to bit 2.
- After initiating A/D conversion, continuously read ATD1SC until the Conversion Complete Flag is set which indicates that ATD1RH contains the result.

The offsets that doAccelMeasurement() uses are determined by the particular hardware that is the source of the analog signal and whether you wish to shift the value to a different result band for some reason.


Regards,
Chuck


0 Kudos
Reply