Moxa TC-6110-T-W7E [73/74] Accelerometer conversion code

Moxa TC-6110-CT-W7E [73/74] Accelerometer conversion code
TC-6110 / Windows 7 Sample Code for TC-6110 Customization
B-6
Accelerometer Conversion Code
if (z_axis > 0x8000)
{
z_axis = 0xFFFF - z_axis + 1;
z_axis *= (-1);
z_axis_mg = z_axis * 0.0039;
z_axis_mg = z_axis_mg * 1000;
}
else
{
z_axis_mg = z_axis * 0.0039;
z_axis_mg = z_axis_mg * 1000;
}
The Watchdog Control Script
// WatchDog.cpp : Defines the entry point for the console application.//
#include "stdafx.h"
#include <windows.h>
#include "devices.h"
int _tmain(int argc, _TCHAR* argv[])
{
int fd;
// Handle to device, obtain from mxwdg_open //
ULONG time;
// This section calls the watchdog timer//
time=10;
fd = mxwdg_open(time);
while ( TRUE )
{
//This section is just a UI provided for debugging. //
//This section should be removed or commented out//
//when using this code when integrating particular programs//
//with the watchdog. //
printf( "Press \"ENTER\" in 10 seconds\n, 'q' to exit");
WCHAR ch = getwchar();
if ( ch == (WCHAR)'q' )
{
break;
}
//This section is the automated timer admins should //
//include to ensure a program is “kicking the dog” //
mxwdg_refresh(fd);
}
// stops watchdog timer
mxwdg_close(fd);
return 0;
}

Содержание

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

Скачать