LSM303DLHC XYZ calculation

Hi,

I'm trying to program 3 axis compass modules.

I'm a bit out of date, and use Oshonsoft visual BASIC simulator and programmer.

I have been able to get the X and Y data through a PIC chip onto a screen, or serial port screen, using a program including this line of code for 0 to 45º: arctn = ax / ay / (1 + 0.28125 * ((ax / ay) * (ax / ay))) * picalc '180/PI (arctn being my named variable, as the Oshonsoft Arctan doesn't work properly)

(It has taken a lot of effort with help from others to get this working, so please don't offer 'better' alternatives)

My question is: Can anyone help me add the 'Z' component into the line of code to give the full calculation for all rotations, please?

Thanks, Camerart

Please read and carefully follow the directions in the "How to use this forum" post.