1 Chapter 3: Tilt with the Memsic Dual-Axis Accelerometer Smart Sensors and Applications Chapter 3: Tilt with the Memsic Dual-Axis Accelerometer Presented by: Andy Lindsay Parallax, Inc.
2 Copyrights and Trademarks This documentation is copyright 2006 by Parallax Inc. By downloading or obtaining a printed copy of this documentation or software you agree that it is to be used exclusively with Parallax products. Any other uses are not permitted and may represent a violation of Parallax copyrights, legally punishable according to Federal copyright or intellectual property laws. Any duplication of this documentation for commercial uses is expressly prohibited by Parallax Inc. Duplication for educational use is permitted, subject to the following conditions: the text, or any portion thereof, may not be duplicated for commercial use; it may be duplicated only for educational purposes when used solely in conjunction with Parallax products, and the user may recover from the student only the cost of duplication. BASIC Stamp, Stamps in Class, Board of Education, Boe-Bot SumoBot, SX-Key and Toddler are registered trademarks of Parallax, Inc. HomeWork Board, Propeller, Ping))) Parallax, and the Parallax logo are trademarks of Parallax Inc. If you decide to use trademarks of Parallax Inc. on our web page or in printed material, you must state that "(trademark) is a (registered) trademark of Parallax Inc.” upon the first appearance of the trademark name in each printed document or web page. Other brand and product names are trademarks or registered trademarks of their respective holders.
3 Chapter 3, Pages The Memsic Dual-Axis Accelerometer
4 Chapter 3, Page 67
5 Chapter 3, Activity #1, Page 68 Circuit: Figure 3-3 on page 68 Program: SimpleTilt.bs2 on page 70. √ Follow the checkmarks on pages
6 Chapter 3, Activity #1, Page 70
7 Chapter 3, Activity #2, Pages Using SEROUT commands instead of DEBUG Circuit: Figure 3-6 and Figure 3-7, pages Program: SimpleTiltLcd.bs2, page 74 √ Follow the checkmarks on page 74.
8 Chapter 3, Activity #3, Pages Applying Scale and Offset: 1.Apply offset to align the input scale to zero. 2.Apply the scale. 3.Apply any additional offset needed for the output scale. Scaling/Offset from 1875 — 3125 to -127 — 127 Applying Scale/Offset to the value variable
9 Chapter 3, Activity #3, Pages Choosing the right ** Constant for Scaling… …and Clamping the Input Range with MIN and MAX
10 Chapter 1, Activity #1, Pages Program: TestScaleOffset.bs2 √ Follow the checkmarks on pages 78 – 80.
11 Chapter 3, Activity #3, Pages PBASIC and Negative Numbers Program:SignedNumbers.bs2 √ Follow the checkmark instructions on page 81. In PBASIC, only Word variables can hold signed numbers, for example: value VAR Word All signed numbers have 16 bits. Look at Bit 15 of the variable to know if a signed number is negative or positive. For example, if the variable value.bit15 is equal to 1, the number is negative.
12 Chapter 3, Activity #4, Page 84 Sample Readings at Various Orientations Scaling and Offset for 1/100 g. Program: SimpleTilt.bs2 √ Follow the checkmark instructions on page 85.
13 Chapter 3, Activity #5, Pages , Calculating Arctangent with ATN The result of an ATN operation is expressed in Brads (Binary Radians) Program: TestAtn.bs2, p. 90 √ Follow the checkmarks on page 89.
14 Chapter 3, Activity #5, Pages Converting from Brads to Degrees with the */ Operator angle = 361 */ angle The */ operator multiplies the operand by a number of 256 ths Program: BradsToDegrees.bs2, page 90 √ Follow the checkmarks on page 90.
15 Chapter 3, Activity #5, Page 92 Measuring Tilt Angle on the Vertical Plane
16 Chapter 3, Activity #5, Pages Program: VertWheelRotation.bs2, p. 95 √ Follow the checkmark on page 95.
17 Chapter 3, Activity #6, Page 99
18 Chapter 3, Activity #6, Pages Sine, Cosine and the Unit Circle Program: SineCosine.bs2, page 101 √ Follow checkmarks on pages 101 – 102. The SIN and COS operators return values from -127 to 127
19 Chapter 3, Activity #6, Pages Arcsine and Arccosine Subroutines Program: TestArcsine.bs2, page 103 √ Follow checkmarks on pages 103, 105.
20 Chapter 3, Activity #6, Page Displaying Accelerometer Tilt Angle Program: HorizontalTilt.bs2, page 108 √ Follow checkmarks on page 108.