Jump to content
Sign in to follow this  
ckd

Interfacing GY-80 (only ADXL345) to TM4C1294NCPDT using energia

Recommended Posts

I am trying to interface GY-80 (only adxl345) to TM4C1294XL board using Energia. But outputs comes out to be 0. And also there comes this error "Failed to load dynamic library: 'ftd2xx.dll' " while uploading but the code gets uploaded successfully. I am pasting the code below, can somebody tell me where i am doing it wrong?


#include "Wire.h"

#define Power_Register 0x2D
#define BW_rate 0x2C
#define Int_enable 0x2E
#define dataFormat 0x31
#define X_Axis_Register_DATAX0 0x32
#define X_Axis_Register_DATAX1 0x33
#define Y_Axis_Register_DATAY0 0x34 
#define Y_Axis_Register_DATAY1 0x35
#define Z_Axis_Register_DATAZ0 0x36
#define Z_Axis_Register_DATAZ1 0x37
#define fifoCntrl 0x38

int ADXAddress = 0x53;
int X0,X1,X_out;
int Y0,Y1,Y_out;
int Z1,Z0,Z_out;
float Xa,Ya,Za;

void setup() {
  Wire.setModule(0);
  Wire.begin(ADXAddress);   
  Serial.begin(115200);    
  delay(100);
  Wire.beginTransmission(ADXAddress);
  Wire.write(Power_Register);
  Wire.write(8);
  Wire.write(BW_rate);
  Wire.write(10);
  Wire.write(dataFormat);
  Wire.write(11);
  Wire.write(fifoCntrl);
  Wire.write(0);
  
  Wire.endTransmission();


}


void loop() {

 Wire.beginTransmission(ADXAddress);
 Wire.write(X_Axis_Register_DATAX0);
 Wire.write(X_Axis_Register_DATAX1);  
 Wire.endTransmission();
 Wire.requestFrom(ADXAddress,2);
 if(Wire.available()<=2) {   
   X0 = Wire.read();
   X1 = Wire.read();
   X1=X1<<8;
   X_out =X0+X1;
  
 }

 Wire.beginTransmission(ADXAddress); 
 Wire.write(Y_Axis_Register_DATAY0);
 Wire.write(Y_Axis_Register_DATAY1);  
 Wire.endTransmission(); 
 Wire.requestFrom(ADXAddress,2);
 if(Wire.available()<=2) { 
   Y0 = Wire.read();
   Y1 = Wire.read();
   Y1=Y1<<8;
   Y_out =Y0+Y1;
 }

 Wire.beginTransmission(ADXAddress); 
 Wire.write(Z_Axis_Register_DATAZ0);
 Wire.write(Z_Axis_Register_DATAZ1);  
 Wire.endTransmission(); 
 Wire.requestFrom(ADXAddress,2);
 if(Wire.available()<=2) { 
   Z0 = Wire.read();
   Z1 = Wire.read();
   Z1=Z1<<8;
   Z_out =Z0+Z1;

 }

 Serial.print("Xa= ");
 Serial.print(Xa);Serial.print("\t");
 Serial.print("Ya= ");
 Serial.print(Ya);Serial.print("\t");
 Serial.print("Za= ");
 Serial.println(Za);

 
 delay(1000);
 Serial.println();
}

Share this post


Link to post
Share on other sites
31 minutes ago, Rei Vilo said:

Have you checked the I²C usual suspect at 

I have set the I2C0 as 'Wire.setModule(0);' Is it wrong?

 

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...