> > |
%META:TOPICINFO{author="ToddHunter" date="1184184689" format="1.0" version="1.1"}%
%META:TOPICPARENT{name="AccelerometerSystemDescription"}%
Date: Wed, 11 Jul 2007 12:55:37 -0400 (EDT)
From: Joe Brandt
To: Todd R. Hunter
The Y and Z axes inputs are 23 bit, bipolar; the X axis is
16 bit unipolar.
So the device reading is first scaled to +/- 1.25 (Y,Z), and
0..1.25 (X). (Assuming VFS is 1.25, as is the case.)
Next the values are offset by Voffs in each axis. Currently the offset
is zero for all axes.
A final step is to pass the voltages through a 'rotation' matrix.
Currently this is set to the identity matrix.
The code almost verbatim:
y_raw = device reading
y_volt = (y_raw - TWO_TO_23) * VFS[Y] / TWO_TO_23;
z_raw = device reading
z_volt = (z_raw - TWO_TO_23) * VFS[Z] / TWO_TO_23;
x_raw = strtoul(buf, &endptr, 16);
x_volt = x_raw * VFS[X] / TWO_TO_16;
# apply offsets and pack the values into a vector
# g_volt is Gconst in the config file and is set to 1.0
raw_g(X, 0) = (x_volt - Voffs[X]) * g_volt[X];
raw_g(Y, 0) = (_accel_data.y - Voffs[Y]) * g_volt[Y];
raw_g(Z, 0) = (z_volt - Voffs[Z]) * g_volt[Z];
# Rotate
final_g = OM * raw_g;
# These are the values written to FITS
accel_data.x = final_g(X, 0);
accel_data.y = final_g(Y, 0);
accel_data.z = final_g(Z, 0);
--jbrandt
-- ToddHunter - 11 Jul 2007
|