Intel® Quark™ Microcontroller D2000 - Accelerometer Tutorial

已更新 7/28/2016
版本 Latest
公共

author-image

作者

Intel® System Studio for Microcontrollers includes multiple sample applications to help you get up to speed with basic functionality and become familiar with the Intel® Quark™ Microcontroller Software Interface (QMSI).  This example reads and outputs accelerometer data to the console. The example (optionally) uses the Intel® Integrated Performance Primitives (Intel IPP) to compute root mean square, variance, and mean for the last 15 Z axis readings.

Author: Richard, A.

Hardware Required

  • Intel® Quark™ Microcontroller D2000 developer board and USB cable

Instructions

  1. Create a project with the "Accelerometer" sample project file
    1. From the File menu, select New and then select Intel® Project
    2. Follow the setup wizard to create your project:
      1. Developer board: Select the D2000 developer board
      2. Project type: Intel® QMSI (1.1)
      3. Selection Connection: USB-Onboard
      4. Project example: Accelerometer
    3. Click Finish.
  2. Select the "Accelerometer" project in the Project Explorer window
  3. Click the Build  button to compile your project
  4. Click the Debug   drop down and select "Accelerometer (flashing)"
    • Note: this option will prompt you to switch to the debug perspective and will write the application to the board.  It also automatically places a breakpoint in the first line of your main function
  5. Setting up output
    1. In the source window (select main.c) locate the “static void print_accel_callback (void *data)” function and copy the contents of the print function QM_PRINTF as seen below: 
      “x %d y %d z %d\n”, accel.x, accel.y, accel.z
    2. Right click on the left hand side of window and select “Add Dynamic Printf…”
    3. Replace the printf( content with the contents you copied in 5a:
    • “x %d y %d z %d\n”, accel.x, accel.y, accel.z
    • Note: This is the data that is computed by the accelerometer sensor and will be displayed in the Console once completing these steps
  6. Click on the Resume [icon] button to continue running the Accelerometer application
  7. View X, Y and Z values from the accelerometer in the Console window

Note: Move around your board to see the x, y, z data change accordingly

"