DrDiettrich:
Great 
How did you cure the before mentioned problem?
TomGeorge:
Correction.. if one way you get 200 upside down shouldn't you get -200, not -300?
Offset of -50 I'd say.
Add 50 to 200 = 250
Add 50 to -300 = -250
Correct me if I'm wrong..
I agree that using 14bit conversion and +/- 8G, you should have 1024 for 1g.
It looks like you are still in 12bit mode as it will give 256 for 1g.
Tom.. 
To be fair, I don't recall at which point did I manage to solve it (Not much serious on my behalf, sorry) but I made some changes and suddenly it was working. I attach the final code relative to the accelerometer just for reference.
As for the complementary filter, I was implementing it wrong as:
Angle_filter = a*(angle_gy) + (1-a)*angle_acc
Whereas it had to be done like this:
Angle_filter = a*(Angle_filter[i-1]+gy_rate*dt) + (1-a)*angle_acc
[/center]
Acc code:
```
*#define ACC_ADDR 0x40 // Accelerometer address (40), binary = 01000000
#define REGADDR_ACC 0x02 // Accelerometer registry address (2), binary = 00000010
#define ACC_1G 1010
/* ACCELEROMETER */
int16_t off_ax = 0, off_ay = 0, off_az = 0; // [LSB] Accelerometer offsets
int16_t aX = 0, aY = 0, aZ = 0; // [LSB] Acc readings in sensor axis
double ax = 0, ay = 0, az = 0, ax2 = 0, ay2 = 0, az2 = 0, angle_x = 0, angle_y = 0;
// [mg],[mg^2],[º] Acc readings, units converted, in board axis
float a = 0.1f; // Complementary filter weight parameter
double angleX = 0, angleY = 0, angleZ = 0; // Complementary filter calculated angles
uint32_t currentTime = 0;
uint16_t previousTime = 0;
uint16_t cycleTime = 0;
void initAcc () {
/*****************************************
* BMA180
* Set to:
* 8G Range -> ADC Resolution: 0.99 [mg/LSB]
* Low Pass Filter = 10Hz
******************************************/
byte buff2[1];
delay(10);
// Default range 2G: 1G = 4096 unit.
writeTo(ACC_ADDR,0x0D,0x10); // register: ctrl_reg0 -- value: set bit ee_w to 1 to enable writing
delay(5);
readFrom(ACC_ADDR, 0x20, 1, buff2);
uint8_t control = buff2[0];
control = control & 0x0F; // save tcs register
//control = control | (0x01 << 4); // register: bw_tcs reg: bits 4-7 to set bw -- value: set low pass filter to 20Hz
control = control | (0x00 << 4); // set low pass filter to 10Hz (bits value = 0000xxxx)
writeTo(ACC_ADDR, 0x20, control);
delay(5);
readFrom(ACC_ADDR, 0x30, 1, buff2);
control = buff2[0];
control = control & 0xFC; // save tco_z register
control = control | 0x00; // set mode_config to 0
writeTo(ACC_ADDR, 0x30, control);
delay(5);
readFrom(ACC_ADDR, 0x35, 1, buff2);
control = buff2[0];
control = control & 0xF1; // save offset_x and smp_skip register
control = control | (0x05 << 1); // set range to 8G -> ADC Resolution: 0.99 [mg/LSB]
writeTo(ACC_ADDR, 0x35, control);
delay(5);
}
void getAccData()
{
/**************************************
Accelerometer BMA180 I2C
registers:
x axis MSB = 0x03, x axis LSB = 0x02
y axis MSB = 0x05, y axis LSB = 0x04
z axis MSB = 0x07, z axis LSB = 0x06
*************************************/
readFrom(ACC_ADDR, REGADDR_ACC, nBytes, buff); // Reads nBytes from BMA180 acc. reg. address onwards and stores them in buff
//usefull info is on the 14 bits [2-15] bits /4 => [0-13] bits /4 => 12 bit resolution
aX = ((((buff[1] << 8) | buff[0])>>2) - off_ax); // [LSB]
aY = ((((buff[3] << 8) | buff[2])>>2) - off_ay); // [LSB]
aZ = ((((buff[5] << 8) | buff[4])>>2) - off_az); // [LSB]
// Board Orientation:
ax=-(((float)aY)*0.99f/1000.0); // [G] (1 LSB / 0.99mg)
ay=-(((float)aX)*0.99f/1000.0); // [G]
az=((float)aZ)*0.99f/1000.0; // [G]
ax2 = (float)ax*(float)ax;
ay2 = (float)ay*(float)ay;
az2 = (float)az*(float)az;
angle_x = -(atan2(-ay, az)*180.0)/M_PI;
angle_y = -(atan2(ax, sqrt(ay2 + az2))180.0)/M_PI;
}
* *
*void setup()
{
Wire.begin();
delay(2000); // To allow board to settle down prior to calibration
initAcc();
int16_t oax = 0;
int16_t oay = 0;
int16_t oaz = 0;
int16_t sum_oax = 0;
int16_t sum_oay = 0;
int16_t sum_oaz = 0;
for(int i=1;i<201;i++)
{
readFrom(ACC_ADDR, REGADDR_ACC, nBytes, buff);
// Reads nBytes from BMA180 acc. reg. address onwards and stores them in buff
oax = (((buff[1] << 8) | buff[0])>>2); // [LSB]
oay = (((buff[3] << 8) | buff[2])>>2); // [LSB]
oaz = (((buff[5] << 8) | buff[4])>>2); // [LSB]
//oaz = oaz-ACC_1G; // [LSB] 1010 LSB = 1G
oaz = oaz-1010;
sum_oax += oax;
sum_oay += oay;
sum_oaz += oaz;
}
off_ax = sum_oax/200;
off_ay = sum_oay/200;
off_az = -sum_oaz/200;
} // End of setup*
* *
*void loop()
{
getAccData();
currentTime = micros(); // [us]
cycleTime = currentTime - previousTime; // [us]
previousTime = currentTime; // [us]
angleX = angle_xa + (1-a)(angle_gx + error_x0.9f); // 2% accelerometer, 98% gyro
angleY = angle_ya + (1-a)(angleY + angle_gy); // Pitch range: -90º to 90º
angleZ = headinga + (1-a)*(angleZ + angle_gz); // Pitch range: 0º to 360º
}*
```
Mind that I have ommited everything relative to the gyro so as to make it more understandable.
The actual code is like 800 lines long. LOL