I just went through this with the SparkFun Tri-Ax accelerometer. As leahb says, basically what you want to do is hold the device still in each of 6 orientations (e.g., z- axis straight up and z-axis straight down) to get the minimum and maximum readings for -1 g and +1 g.

E.g., for the Tri-Ax, I got analogRead() values of 520 with the z-axis pointing down and 182 with the z-axis pointing up. For a given analogRead() value Z then, the formula for g force would be the straight line:

gz = mZ + b

where:

gz = acceleration along the z-axis in g's

m = 2/(max - min) = 2/(520 - 182) = 0.005917

and b = 1 - m*max = 1 - 0.005917*520 = -2.076

For the tilt angles, given g readings of gx, gy and gz calculated as above as floats, and using the math library (#include <math.h>):

rho = pitch angle of x-axis relative to ground = atan2(gx,sqrt(gy*gy + gz*gz))

phi = roll angle of y-axis relative to ground = atan2(gy,sqrt(gx*gx + gz*gz))

theta = angle of z-axis relative to gravity = atan2(sqrt(gx*gx + gy*gy),gz))

atan2() returns the angle in radians -PI to +PI, so multiply by 360.0/(2*PI) to convert to degrees.