10 years, 7 months ago.

i2c newbie question

Hi,

I'm running your example program and taking x,y,z readings from the MMA8452 accelerometer. It seems to work fine.

I'm very new to this interface and understanding how the interface works. From the documentation on freescale web site: http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Sensors/Accelerometers/MMA8452Q.pdf

It says the master write address is 0x1D. You never use this in your program. You seem to be using 0x3A.

Why does your code work! ? :-) ... Am I missing something?

Kind regards, Nicholas.

Question relating to:

1 Answer

10 years, 7 months ago.

"It says the master write address is 0x1D. You never use this in your program. You seem to be using 0x3A."

This is the ever returning question about the fact that I2C addresses are often given as a 7bit value, whereas the mbed lib uses an 8bit address that is formed by shifting the 7bit address 1 position to the left: 0x3A = 0x1D << 1;

Accepted Answer

Ahhh! The light is now shining through the thunder clouds!!! Thank you - thank you - thank you .... :-)

If I ever meet you - I'll get the coffees :-)

Please accept my gratitude - and I'll comment and change your code if you want to accept changes this may stop those questions from people like me... :-)

Kind regards, Nicholas.

posted by Nicholas Herriot 24 Sep 2013