3 axis accelerometer forces as angles/vectors

Hello,

I have a three axis accelerometer that I am using in project that I am working on and I need to find the angle/vector of the axis’s when the device is not orientated to its designated axis, and when it is accelerating. If I lay the device flat on a horizontal surface and read the outputs from the z axis I get 1g, and 0 for the x and y axes which is correct.

I can translate the g forces into angle/vectors like so:

sin-1x = 90, sin-1y = 0, sin-1z = 0 which is correct, also I can rotate the device about and this sin-1, still returns the correct angle/vector.

However, this only works when the accelerometer is stationary as when it is moved the g force changes and this simple sin-1 produces incorrect results.

Can someone help please?

Many thanks in advance IMK