Moxa TC-6110-W7E [47/74] G sensor accelerometer control code

Moxa TC-6110-CT-LX [47/74] G sensor accelerometer control code
TC-6110 / Windows 7 Customizable Sample Code
5-3
G-Sensor/Accelerometer Control Code
The TC-6110 computer comes with 2 independent accelerometers that may be used to monitor external
vibrations affecting the computer. The accelerometers are located on the board of each of the two SATA
expansion modules. The basic accelerometer control code is included under the title G-Sensor.exe, and it may
be found on the software DVD under
\examples\TC6000Release. The source code itself may be found
under
\examples\project\GSensor\. To review the accelerometer control code you may refer to
Appendix B of this manual, under
The Accelerometer Control Script.
You can follow the steps below to test the accelerometer. Please remember that the X-axis represents
front-to-back motion (relative to the sensor), the Y-axis is left-to-right, and the Z-axis is up-and-down. A good
target threshold to start off with is 1000 milligravities (mG), which is the basic tolerance threshold for many
industrial-quality hard drives.
Accelerometer Control Walkthrough
1. If you haven’t yet, create the folder c:\programs\examples, then copy over GSensor.exe.
2. Insert the TC-6110 SATA expansion module into slot 1. Leave slot 2 empty.
3. Run GSensor.exe and check to see if the G-sensor is registering raw vibration measurements. In the
screenshot below, because only the slot 1 SATA module has been inserted, the program is only showing
information for that accelerometer; this is indicated by the message GSensor on Disk1 is running.
Similarly, because no module is mounted in slot 2, the message GSensor on Disk 2 is unavailable is
displayed.
4. Following the two sensor messages indicating sensor operation, information for each available sensor is
shown; the origin of the raw data is indicated by the number in parentheses at the end of the label, just
before the equal sign. (0) indicates the accelerometer in slot 1; (1) indicates slot 2.
5. Data for each of the three axes is displayed separately, on a single line. The number shown is a raw two’s
complement notation binary data value, displayed in base ten form. This raw value must be converted
before it represents milligravities (mG). In the screenshot above, the only axis indicating vibration is the
z axis, which is showing 65517. To convert this number into milligravities, we must first convert it from
two’s complement representation and then multiply that result by a conversion ratio of 3.9 (base ten).
Using the number 65517, above, we first convert it to hexadecimal value. 65,517
10
= 1111111111101101
2
,
which is equal to FFED
16
. The left-most bit is a 1, so this means the number is a negative value and we
must convert from two’s complement notation. To do this, (-1)*(0xFFFF-0xFFED +1) = -13
16
, or -19 in
base ten (-19
10
). We then multiply this number by 3.9
10
to get the value in milligravities: -19 * 3.9
= -74.1.
To review the conversion code, check Appendix B,
Accelerometer Conversion Code.
ATTENTION
G
-sensor / accelerometer values are base 10 representations of raw binary data, and must first be
converted
using bitwise operations before they can be read as milligravities (mG). The formula for
conversion is to first convert the binary number from two’s complement notation into base 10
, then
multiply the result
by 3.9. For sample code, check Appendix B, Accelerometer Conversion Code.

Содержание

Похожие устройства

Скачать