ARM技术论坛
直播中

emitter

5年用户 1883经验值
擅长:可编程逻辑 存储技术
私信 关注
[资料]

基于ARM7 ADUC7020+MPU6050的计步算法

下文转载自网络:

最近在忙个人的国家级大学生创新创业,做的一个手环,这是比较流行的一个demo
但是,我试了一下,我的平台是STC12效果不是很好,可能用其他16位或者32位
单片机跑的话效果更好,我自己也设计了一个算法,但是,写了两天效果不好,我打算
还是自己优化,毕竟后期自己也发核心论文,需要的可以下一下,最近做智能穿戴设备的老铁们。

单片机源程序如下:
  1. /*********************************************************************

  2. Author        : J Scarlett

  3. Date          : Nov 2006

  4. Files          : main.c, display.c, ped.c

  5. Hardware      : ADuC7020

  6. Description   : Implements a simple pedometer based on application
  7.                                          note AN-602
  8.                
  9. *********************************************************************/
  10. #include

  11. //        Function Prototype with required function attribute.
  12. extern void Monitor_Function(void);
  13. extern void Display_Init(void);


  14. //*********************************************************************
  15. // Main Function for ADuC7020 Pedometer
  16. //                        essentially performs startup functions
  17. //*********************************************************************
  18. int main (void)
  19. {

  20.         POWKEY1 = 0x01;
  21.         POWCON = 0x06;                                                // set to 653kHz core clock
  22.         POWKEY2 = 0xF4;
  23.         REFCON = 0x2;                                                // use external reference
  24.                                                                                 //        (connected to Vdd)
  25. //*********************************************************************
  26. //        Initialize Peripherals
  27. //*********************************************************************
  28. // GPIO Configuration
  29.         GP4DAT = 0x04000000;                                // P4.2 configured as an output.
  30.                                                         //         LED is turned on        
  31.         GP0CON = 0x00000000;                                 //
  32.         GP0DAT = 0xE0000000;                                // 0.7, 0.6, and 0.5 are outputs
  33.                                                         // 0.7 = E, 0.5 = R/W*, 0.6 = RS
  34.         GP1DAT = 0xFF000000;                                // All P1 pins are outputs

  35.         ADCCON = 0x20;                                                // Turn ADC on but do not enable

  36.         Display_Init();                                                // found in file "display.c"
  37.         Monitor_Function();                                        // found in file "ped.c"
  38. //*********************************************************************
  39. // Main Loop
  40. //*********************************************************************
  41.         while(1)
  42.         {
  43.         }
  44. } // main()


更多回帖

发帖
×
20
完善资料,
赚取积分