Page 1 of 1

I2C ADXL345 accelerometer

Posted: Fri Feb 19, 2010 7:51 pm
by MGennard
Hey guys,

Finally managed to sort out my user profile so i can start asking the code master some serious questions.

I am working on a hexapod robot software basically from scratch using flowcode for my masters project. However i have now come up against a huge wall. This wall is the I2C ADXL345 tri axis accelerometer.

I want to be able to keep the body of the robot stable so have opted to use an accelerometer. However i cannot read the I2C data from the chip.

Also to note i cannot read the battery information from the I2C SD21 servo motor controller. However in both cases i can write information to them. I do know that the way to read information from the chips is different from the write, but even when i follow that method i am at a loss as to why i get nothing back.

If any one could give me a hand on this i would really appreciate it.

Thanks,

Mat

Re: I2C ADXL345 accelerometer

Posted: Mon Feb 22, 2010 10:17 am
by Benj
Hello Mat

Yes the read is a bit strange on I2C. This info is taken from the I2C component help file.

Receiving Data
Output a start condition //Starts the device listening to the IΒ²C bus.
Transmit the External Device address with the LSB cleared. //Enables the device and sets to write mode.
Transmit the Internal address. //Sets the address to start reading data from.
Output a restart condition //Restarts the device listening to the IΒ²C bus.
Transmit the External Device address with the LSB set. //Enables the device and sets to read mode.
Receive a byte of data with last byte 0. //Device will send data and increment internal address until page limit is reached
....
Receive a byte of data with last byte 1. //Device will send data.
Output a stop condition //Stops the device listening to the IΒ²C bus.