I2C ADXL345 accelerometer

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
MGennard
Posts: 1
Joined: Sat Nov 14, 2009 3:08 pm

I2C ADXL345 accelerometer

Post 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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: I2C ADXL345 accelerometer

Post 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.

Post Reply