In my Previous Post , I have discussed Interfacing TMP006 contact less temperature sensor with CC3200 Launch Pad.... In this week I have received all Kits from ADI as part of this design challenge...
Today, I am sharing interfacing of ADXL375 +-200g Accelerometer with CC3200 LaunchPad, Using the same code you can Interface ADXL375 with Arduino or MSP430.... etc using Arduino or Energia or any uc Supporting Arduino like Library.
Test Setup....
Here is energia code for ADXL375 interfacing with CC3200 LaunchPad...
// ADXL375 Interfacing with CC3200 LaunchPad....
#include <Wire.h>
#define DEVICE (0x53) // Device address of ADXL375
byte _buff[6];
char POWER_CTL = 0x2D; //Power Control Register
char DATA_FORMAT = 0x31;
char DATAX0 = 0x32; //X-Axis Data 0 & following 5 bytes for X Y Z axis
void setup()
{
  Wire.begin();        // join i2c bus (address optional for master)
  Serial.begin(9600);  // start serial for output. Make sure you set your Serial Monitor to the same!
  Serial.print("Started");
  writeTo(DATA_FORMAT, 0x01);
  //Put the ADXL375 into Measurement Mode by writing 0x08 to the POWER_CTL register.
  writeTo(POWER_CTL, 0x08);
}
void loop()
{
  readAccel(); // read the x/y/z tilt
  delay(50); // only read every 0,5 seconds
}
void readAccel() {
  uint8_t howManyBytesToRead = 6;
  readFrom( DATAX0, howManyBytesToRead, _buff); //read the acceleration data from the ADXL375
  // LSB First
  // in cc3200 int is for 32 bit signed and short int is 16 bit signed
  short int x = (((short int)_buff[1]) << 8) | _buff[0];  
  short int y = (((short int)_buff[3]) << 8) | _buff[2];
  short int z = (((short int)_buff[5]) << 8) | _buff[4];
  Serial.print("x: ");
  Serial.print( x );
  Serial.print(" y: ");
  Serial.print( y );
  Serial.print(" z: ");
  Serial.println( z );
  }
void writeTo(byte address, byte val) {
  Wire.beginTransmission(DEVICE); // start transmission to device
  Wire.write(address);            // send register address
  Wire.write(val);                // send value to write
  Wire.endTransmission();        // end transmission
}
// Reads num bytes starting from address register on device in to _buff array
void readFrom(byte address, int num, byte _buff[]) {
  Wire.beginTransmission(DEVICE); // start transmission to device
  Wire.write(address);            // sends address to read from
  Wire.endTransmission();        // end transmission
  Wire.beginTransmission(DEVICE); // start transmission to device
  Wire.requestFrom(DEVICE, num);    // request 6 bytes from device
  int i = 0;
  while(Wire.available())        // device may send less than requested (abnormal)
  {
    _buff[i] = Wire.read();    // receive a byte
    i++;
  }
  Wire.endTransmission();        // end transmission
}
Interfacing Schematic...
EVAL-ADXL375Z Breakout Board Pin-out..
Demo Video...
        
    
    
	
	
	
	
   
References :
http://www.analog.com/media/en/technical-documentation/user-guides/EVAL-ADXL375_User_Guide.pdf
http://www.analog.com/media/en/technical-documentation/data-sheets/ADXL375.PDF
http://energia.nu/wordpress/wp-content/uploads/2014/09/cc3200lppinmap.jpg
			    



