Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

c8051 and freescale mmma7660 i2c protocol

Status
Not open for further replies.

tretra

Newbie level 1
Newbie level 1
Joined
Jun 21, 2014
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
8
I'm trying to interface the freescale mma7660 accelerometer with an 8051 processor (c8051f020 silicon labs).
I get some problems while I communicate with the smbus:
I receive acks from the accelerometer, but the data I get is always 0.
This is my initialization code (for the accelerometer):

Code:
 SMB_DATA_IN[0] = 0x07; //stand by mode
 SMB_DATA_IN[1] = 0x00; 
 SMB_Write();           //write data on the smbus
 delay1ms(100);
 
 SMB_DATA_IN[0] = 0x06; //auto interrupt
 SMB_DATA_IN[1] = 0x10;
 SMB_Write();
 delay1ms(100);
 
 SMB_DATA_IN[0] = 0x08; //auto wake up
 SMB_DATA_IN[1] = 0x00;
 SMB_Write();
 delay1ms(100);
 
 SMB_DATA_IN[0] = 0x07; //active mode
 SMB_DATA_IN[1] = 0x01;
 SMB_Write();
 delay1ms(100);

And this is my read function:

Code:
void readData() {
 SMB_DATA_IN[0] = 0x00;//X value
 SMB_Write();
 delay1ms(100);
 
 SMB_Read();  //reads data and put everything in an array
}

I'm quite sure my smbus initialization is correct because I use the i2c protocol with other components without getting any problem.
This is the datasheet

Did I do something wrong? Any help would be greatly appreciated :)
Thanks
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top