7tri-axis accelerometer example, Pitx-sp software guide – Kontron pITX-SP User Manual
Page 37
KTD-S0003-C
Page 33
Tri-Axis Accelerometer Example
p
ITX-SP Software Guide
7
Tri-Axis Accelerometer Example
The accelerometer is not available before hardware revision 3.0 (only the
Plus
variant). The sensor chip
ML8953 (OKI) based on a piezo-resistive sensing principle. Acceleration measurement range: ±3g.
#include
#include
#include
#include
#define ESC_CHAR
27
#define FALSE
0
#define TRUE
1
#define SMBUS_ENTRY
0xF8
#define DEVICE_ADDR
0x6E
#define SMBUS_READ_BYTE
0x00
#define SMBUS_WRITE_BYTE
0x01
#define INT_SERVICE
0x15
#define PAGE_REG
0x1E
#define OP_MODE_REG
0x03
#define STATUS_REG
0x01
#define XAXIS_REG
0x0A
#define YAXIS_REG
0x0C
#define ZAXIS_REG
0x0E
#define COMPOSITE_REG
0x10
#define PAGE0
0x00
#define PAGE1
0x01
#define START_MEASURE
0x08
typedef unsigned char byte;
typedef unsigned int word;
typedef unsigned long dword;
void WriteReg (byte reg, byte val)
{
union REGS regs;
regs.h.ah = SMBUS_ENTRY;
regs.h.al = SMBUS_WRITE_BYTE;
regs.h.bh = DEVICE_ADDR;
regs.h.bl = reg;
regs.h.cl = val;
int86 (INT_SERVICE, ®s, ®s);
}