
41
Accessing the Digital Accelerometer
Appendix C
Embedded and Industrial Computing
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) ;
}
}
Comentarios a estos manuales