AnsweredAssumed Answered

How to read MMA8451 values having only i2c_read and i2c_write functions?

Question asked by edelm on Feb 14, 2014
Latest reply on Feb 17, 2014 by Tomas Vaverka

We got a boad with BLE113 Bluetooth chip onboard and mma8451Q sensor.

The board has SDK and in the SDK there is only i2c read and write functions.

Can you please give an example of how to read full X Y Z values using only read and write functions?


Please, we have tried so many, but we cannot get any adequate result.


enum {

    MMA845X_STATUS = 0x00,








dim tmp(6)

dim acc(6)

what we do is we activate the accelerometer:

#start accelerometer

    acc(0:1)=$2a #CTRL_REG1 address

    acc(1:1)=3  #enable accelerometer, set fast mode

    call hardware_i2c_write($38,1,2,acc(0:2))


then we read the values

    #read acceleration


    call hardware_i2c_write($38,0,1,acc(0:1))#set address

    call hardware_i2c_read($38,1,6)(result,data_len,tmp(0))#read data

This suppose to read the values high and low bytes but it does not work this way.

The return value is 3 bytes only,