mma7660 reading problem
I'm having problem to impliment i2c for mma7660 to interfacie with AT89s52.
i have interfaced ds1307 to AT89s52.same i2c code is not working for this.
please help me.
check your code you must be doing something wrong. even a slight bit error can make a lot of difference in I2C.
You can make use of code given in website for help.
are you guys from some training institute or something? coz everyone is coming up with same problem.
check your code you must be doing something wrong. even a slight bit error can make a lot of difference in I2C.
You can make use of code given in website for help.Ajay Bhargav
of course every one will come up with same problem because the first link given by google is to this website if we search for "mma7600 and 8051" in google, and no other forum site discussing on mma7660.
hello,
I'm having problem to impliment i2c for mma7660 to interfacie with AT89s52.
i have interfaced ds1307 to AT89s52.same i2c code is not working for this.
please help me.bobby.sweet75
it will be better if u write ur code here.
hi,
I am posting my code here.is there anything wrong with this# define MMA7660_ID 0x4C # define XOUT 0x00 # define YOUT 0x01 # define ZOUT 0x02 # define TILT 0x03 # define SRST 0x04 # define SPCNT 0x05 # define INTSU 0x06 # define MODE 0x07 # define SR 0x08 # define PDET 0x09 # define PD 0x0A #define FSL_MMA_AddW 0x98 //MMA7660 Address for Writing #define FSL_MMA_AddR 0x99 //MMA7660 Address for Reading #define FSL_MMA_StartAddress 0x00 //MMA7660 g-value registers' start address void MMA7660_Write(unsigned char ucAddr,unsigned char ucData) { I2cStart(); I2cWrite(MMA7660_ID); if (IIC_ChkAck()) { #ifdef ACC_DEBUG Lcd_Clear(); LcdGotoXy(0,0); Lcd_Print("WR Address Error"); #endif I2cStop(); return; } I2cWrite(ucAddr); if (IIC_ChkAck()) { #ifdef ACC_DEBUG Lcd_Clear(); LcdGotoXy(0,0); Lcd_Print("Sensor Reg NACK"); #endif I2cStop(); return; } I2cWrite(ucData); if (IIC_ChkAck()) { #ifdef ACC_DEBUG Lcd_Clear(); LcdGotoXy(0,0); Lcd_Print("Sensor Data NACK"); #endif I2cStop(); return; } I2cStop(); } unsigned char MMA7660_Read(unsigned char ucAddr) { unsigned char ucData; I2cStart(); I2cWrite(MMA7660_ID); if((IIC_ChkAck())==0) { Lcd_Clear(); LcdGotoXy(0,0); Lcd_Print("WR Address Error"); I2cStop(); } I2cWrite(ucAddr); if((IIC_ChkAck())==0) { Lcd_Clear(); LcdGotoXy(0,0); Lcd_Print("Sensor Reg NACK"); I2cStop(); } I2cRepeatStart(); I2cWrite(MMA7660_ID+1); if (IIC_ChkAck()) { #ifdef ACC_DEBUG Lcd_Clear(); LcdGotoXy(0,0); Lcd_Print("RD Address Error"); #endif I2cStop(); return 0; } ucData=IIC_ReadByteNCK(); #ifdef ACC_DEBUG Lcd_Clear(); LcdGotoXy(0,0); Lcd_Print("Read Success"); #endif I2cStop(); return ucData; } void MMA7660_Init(void) { MMA7660_Write(MODE,0x00); MMA7660_Write(SPCNT,0x00); MMA7660_Write(INTSU,0x03); MMA7660_Write(PDET,0xE0); MMA7660_Write(SR,0x34); MMA7660_Write(PD,0x00); MMA7660_Write(MODE,0x41); }bobby.sweet75
@bobby.sweet75, DO NOT CREATE MULTIPLE THREADS for your problems. use the QUICK REPLY form provided at the end of post or use POST REPLY button to reply to a post.
of course every one will come up with same problem because the first link given by google is to this website if we search for "mma7600 and 8051" in google, and no other forum site discussing on mma7660.
rohit.astronaut
the reason i said that is coz all people asking these queries are from hydrabad coz of which i thought that. so case is either you people are from same batch or institutes or your companies are working on a similar kind of projects
[ Edited Wed Jul 28 2010, 04:25 pm ]