Wiki

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
resources:quick-start:adxl313_quick_start_guide [16 Jul 2020 23:29] – added DATA FORMAT section Pablo del Corroresources:quick-start:adxl313_quick_start_guide [16 Jul 2020 23:58] – [INITIALIZATION] Pablo del Corro
Line 43: Line 43:
 The interrupt behavior, latch high or latch low, can be configured through the DATA_FORMAT register. Refer to the ADXL313 data sheet for details. The interrupt behavior, latch high or latch low, can be configured through the DATA_FORMAT register. Refer to the ADXL313 data sheet for details.
  
 +<note tip>
 +Always make set the ADXL313 in Standby mode first before configuring any register. 
 +</note>
 ==== DATA FORMAT ==== ==== DATA FORMAT ====
 The ADXL313 registers length is 8 bits, while its acceleration in full resolution is 13 bits. Thus the acceleration data of each axis is stored in two registers. For example, for X-axis DATAX0 is the low byte register and DATAX1 is the high byte register. Once acceleration data is acquired from data registers, the user must reconstruct the data as a 16-bits word length.  The ADXL313 registers length is 8 bits, while its acceleration in full resolution is 13 bits. Thus the acceleration data of each axis is stored in two registers. For example, for X-axis DATAX0 is the low byte register and DATAX1 is the high byte register. Once acceleration data is acquired from data registers, the user must reconstruct the data as a 16-bits word length. 
Line 50: Line 53:
 {{ :resources:quick-start:xl-dataconstruction.png?nolink&400 |}} {{ :resources:quick-start:xl-dataconstruction.png?nolink&400 |}}
  
-<note tip> 
 In programming language this will be equivalent to:  In programming language this will be equivalent to: 
 <code> <code>
Line 56: Line 58:
 </code> </code>
 with X_16bits a variable defined as uint16.  with X_16bits a variable defined as uint16. 
-</note> 
  
-Make sure to zero the unwanted MSB (14th to 16th bit) by doing: +Also make sure to zero the unwanted MSB (14th to 16th bit) by doing: 
  
 <code> <code>
-X_16bits  = X_16bits & 0x1FFF;+X_raw  = X_16bits & 0x1FFF;
 </code> </code>
- +where **X_raw** is uint16 that contains actual acceleration information formatted as **two's complement**
-<note important>The ADXL313 uses two's complement data format.</note>+
  
 The two's complement function can be implemented with the following code: The two's complement function can be implemented with the following code:
Line 77: Line 77:
 } }
 </code> </code>
-For this example, the argument **value** will be X_16bits and the argument **bits** will be 13 (full resolution). +For this example, the argument **value** will be X_raw and the argument **bits** will be 13 (full resolution). 
  
 To calculate the acceleration value in units of //g//, multiply the two's complement value obtained times the Scale Factor (1/sensitivity, units: [g]/LSB) at the given range and resolution. For this example, the Scale Factor is 4 [g]/ 1024 LSB which is equal to 3.9[m//g//]/LSB. To calculate the acceleration value in units of //g//, multiply the two's complement value obtained times the Scale Factor (1/sensitivity, units: [g]/LSB) at the given range and resolution. For this example, the Scale Factor is 4 [g]/ 1024 LSB which is equal to 3.9[m//g//]/LSB.
  
-<note important>Always review the [[ADI>media/en/technical-documentation/data-sheets/ADXL313.pdf|ADXL313 datasheet]] for detailed information</note>  +In code this is:  
 +<code> 
 +X_g = (twos_complement(X_raw,13))*0.0039; 
 +</code>  
 +where **X_g** is the X-axis acceleration in units of //g//. 
 + 
 +<note tip>Always review the [[ADI>media/en/technical-documentation/data-sheets/ADXL313.pdf|ADXL313 datasheet]] for detailed information</note>  
  
resources/quick-start/adxl313_quick_start_guide.txt · Last modified: 16 Jul 2020 23:59 by Pablo del Corro