AnsweredAssumed Answered

Problems with MMA7660

Question asked by Manuel Jimenez Franco on Apr 23, 2010
Latest reply on Jan 28, 2011 by Enrique Sanchez

I'm trying to read an accelerometer MMA7660 with a PIC microcontroller and a program 

CCS. 
The code I'm using is this: 

 

 

#define DIR_MMA7660  0x4C

#define  RegX  0

#define  RegY  1

#define  RegZ  2

 

#define I2C_LEER        1

#define I2C_ESCRIBIR    0


int8 EjeX, EjeY, EjeZ;


void LecturaMMA7660() {

   i2c_start();

   i2c_write(DIR_MMA7660 | I2C_ESCRIBIR);

   i2c_write(RegX);

   i2c_start();

   i2c_write(DIR_MMA7660 | I2C_LEER);

   EjeX=i2c_read(1);

   EjeY=i2c_read(1); 

   EjeZ=i2c_read(0);

   i2c_stop();

}

 

but can not get no result. Can anyone give me some advice?

Outcomes