Please help !

Post Reply
szkinike
Posts: 1
Joined: Sun May 20, 2012 9:45 am

Please help !

Post by szkinike »

Hy!

I have a problem.

The MMA7455 works fine in 1.7:

"
#if defined(MMA7455)
static int8_t rawADC_MMA7455[6];

void i2c_ACC_init () {
delay(10);
i2c_rep_start(0x3A); // I2C write direction
i2c_write(0x16); // Mode Control
//i2c_write(0x25); // Set Sensitity Value @ 2g
i2c_write(0x21); // Set Sensitity Value @ 8g


acc_1G = 64;
acc_25deg = 27; // = acc_1G * sin(25 deg)
accPresent = 1;
}

void i2c_ACC_getADC () {

//TWBR = ((16000000L / 400000L) - 16) / 2; // change the I2C clock rate to 400kHz, ADXL435 is ok with this speed
//i2c_rep_start(0x3A);
//i2c_write(0x09);
//i2c_rep_start(0x3B);


i2c_rep_start(0x3A); // I2C write direction
i2c_write(0x00); //Registry to start reading from.
i2c_rep_start(0x3B); // I2C read direction => 1

for(uint8_t i = 0; i < 5; i++) {
rawADC_MMA7455[i]= i2c_readAck();}
rawADC_MMA7455[5]= i2c_readNak();

accADC[ROLL] = ((char(rawADC_MMA7455[1])<<8) | (rawADC_MMA7455[0]>>1)<<1);
accADC[PITCH]= ((char(rawADC_MMA7455[3]<<8)) | (rawADC_MMA7455[2]>>1)<<1);
accADC[YAW] = ((char(rawADC_MMA7455[5]<<8)) | (rawADC_MMA7455[4]>>1)<<1);
}
#endif


but it does not work in 2.0

Whats the problem??

Thx

Szkini
"

mr.rc-cam
Posts: 457
Joined: Wed Jul 27, 2011 11:36 pm

Re: Please help !

Post by mr.rc-cam »

Check the GUI's i2C error counter. If it is reporting errors then read this for the hardware fix:
viewtopic.php?f=8&t=986

- Thomas

Post Reply