Lanner LVC-5000(N4) Manual de usuario Pagina 34

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 42
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 33
34
Accessing the Digital Accelerometer
Appendix C
Embedded and Industrial Computing
Appendix C:
Accessing the Digital
Accelerometer Data from
the LVC-5000
The system employs Analog Devicess ADXL345 Digital
Accelerometer which is a small, thin, ultralow power, 3-axis
accelerometer with high resolution (13-bit) measurement
at up to ±16 g. It interfaces with the LVC-5000 through a
SPI interface.
To access the Gsensor data, locate the adxl345_v001 folder
and execute the executable file adxl345 and it will show G
value of 3 axes.
Driver Installation
To access the G-Sensor data, use the following
instructions:
Make sure you already installed the Lanner GPIO 1.
driver on your LVC-5000 as instructed in Appendix B.
To access the Gsensor data, locate the adxl345_v001 2.
folder and execute the executable file adxl345 and it
will show G value of 3 axes.
A sample program in C:++
// main.cpp
// The adxl345.exe utility shows the 3 axis G value.
//
// History:
// 07/15/2011: Initial version
#include <winsock2.h>
#include <windows.h>
#include <stdio.h>
#include “ich7.h
#include “adxl345.h
void adxl345_init()
{
ich7_SM_WriteByte (0x1D, POWER_CTL, ACT_INACT_
SERIAL | MEASURE) ; // Power CTL:
Measure mode, Activity and Inactivity Serial
ich7_SM_WriteByte (0x1d, BW_RATE, RATE_100);
/ /
Output Data Rate: 100Hz
ich7_SM_WriteByte (0x1d, DATA_FORMAT, FULL_
RESOLUTION | DATA_JUST_LEFT | RANGE_16G);
/ /
Data Format: 16g range, right justified, 256->1g
}
int main(int argc, char* argv[])
{
adxl345_init () ;
while (1)
{
short x = (short) ich7_SM_ReadByte
(0x1d, DATAX1) << 8 | ich7_SM_ReadByte (0x1d,
DATAX0)<<0 ;
short y = (short) ich7_SM_ReadByte
(0x1d, DATAY1) << 8 | ich7_SM_ReadByte (0x1d,
DATAY0)<<0 ;
short z = (short) ich7_SM_ReadByte
(0x1d, DATAZ1) << 8 | ich7_SM_ReadByte (0x1d,
DATAZ0)<<0 ;
printf (“\rX=%.2f Y=%.2f Z=%.2f, ((float)
x)/2048,((float)y)/2048,((float)z)/2048) ;
}
}
Vista de pagina 33
1 2 ... 29 30 31 32 33 34 35 36 37 38 39 40 41 42

Comentarios a estos manuales

Sin comentarios