×
单片机 > 单片机程序设计 > 详情

基于ARM7 ADUC7020+MPU6050的计步算法

发布时间:2020-08-27 发布时间:
|

单片机源程序如下:

/*********************************************************************


Author        : J Scarlett


Date          : Nov 2006


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


Hardware      : ADuC7020


Description   : Implements a simple pedometer based on application

                                         note AN-602

                

*********************************************************************/

#include


//        Function Prototype with required function attribute.

extern void Monitor_Function(void);

extern void Display_Init(void);



//*********************************************************************

// Main Function for ADuC7020 Pedometer

//                        essentially performs startup functions

//*********************************************************************

int main (void)

{


        POWKEY1 = 0x01;

        POWCON = 0x06;                                                // set to 653kHz core clock

        POWKEY2 = 0xF4;

        REFCON = 0x2;                                                // use external reference

                                                                                //        (connected to Vdd)

//*********************************************************************

//        Initialize Peripherals

//*********************************************************************

// GPIO Configuration

        GP4DAT = 0x04000000;                                // P4.2 configured as an output.

                                                        //         LED is turned on        

        GP0CON = 0x00000000;                                 //

        GP0DAT = 0xE0000000;                                // 0.7, 0.6, and 0.5 are outputs

                                                        // 0.7 = E, 0.5 = R/W*, 0.6 = RS

        GP1DAT = 0xFF000000;                                // All P1 pins are outputs


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


        Display_Init();                                                // found in file "display.c"

        Monitor_Function();                                        // found in file "ped.c"

//*********************************************************************

// Main Loop

//*********************************************************************

        while(1)

        {

        }

} // main()


关键字:ARM7  ADUC7020  MPU6050  计步算法

『本文转载自网络,版权归原作者所有,如有侵权请联系删除』

热门文章 更多
8051单片机的函数发生器的设计