OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 2289|回复: 1

Mini

[复制链接]

2

主题

3

帖子

0

精华

新手上路

积分
24
金钱
24
注册时间
2017-11-28
在线时间
0 小时
发表于 2017-11-29 21:42:01 | 显示全部楼层 |阅读模式
#include "sys.h"
#include "usart.h"               
#include "delay.h"       
#include "led.h"   
#include "lcd.h"  
#include "key.h"   
#include "mpu6050.h"
#include "usmart.h"   
#include "inv_mpu.h"
#include "inv_mpu_dmp_motion_driver.h"
#include "timer.h"
#include "IIR_Filter.h"
//ALIENTEK Mini STM32¿a·¢°åà©Õ1êμÑé16
//MPU6050áùÖá′«¸DÆ÷ êμÑé -¿aoˉêy°æ±¾
//¼¼êõÖ§3Ö£owww.openedv.com
//1ãÖYêDDÇòíμç×ó¿Æ¼¼óDÏT1«Ë¾

extern int biaozhi;
extern short aacx,aacy,aacz;                //¼óËù¶è′«¸DÆ÷Ô-ê¼êy¾Y
extern short gyrox,gyroy,gyroz;        //íóÂYòÇÔ-ê¼êy¾Y
double x,k,p,Last_X0,Last_P0,Q,R;
double cishu=1;

//        óÃóúÂË2¨¼ÆËã
__IO double w0[3] = {0};
//__IO float w1[jieshu][3] = {0};
__IO double w1[3] = {0};
__IO double w2[3] = {0};
__IO double w3[3] = {0};
__IO double x0 = 0;
__IO double x1 = 0;
__IO double x2 = 0;
__IO double y0 = 0;
__IO double y1 = 0;
__IO double y2 = 0;


//¿¨¶ûÂüÂË2¨oˉêy
double kalman_filter(int yc,double  Q, double R, double X0,double P0, double cishu)
{
        if(cishu==1)
        {
                Last_X0=X0;
                Last_P0=P0;
                return X0;
        }
       
        k=Last_P0/(Last_P0+R);
        x=Last_X0+k*(yc-Last_X0);
        p=Last_P0-k*Last_P0+Q;
        Last_X0=x;
        Last_P0=p;
        return x;
}

int main(void)
{
         int j,i;
         double ant[1000][100];
         double b[2]={1,2};
         double gyroyka=0;
         int aacx1=-100000;
         double daitongyjiao=0;
         short daitongyjiao1=0;
        float pitch,roll,yaw;                 //Å·à-½Ç
  char ag[10],yg[10],zg[10],ac[10],yc[10],zc[10],yyc[10],daitong[10];
        NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
        delay_init();                     //Ñóê±oˉêy3õê¼»ˉ          
        uart_init(460800);                 //′®¿ú3õê¼»ˉÎa460800
        usmart_dev.init(72);                //3õê¼»ˉUSMART
  //LED_Init();                                          //3õê¼»ˉóëLEDᬽóμÄó2¼t½ó¿ú
        //KEY_Init();                                        //3õê¼»ˉ°′¼ü
        //LCD_Init();                                           //3õê¼»ˉLCD  
//        MPU_Init();                                        //3õê¼»ˉMPU6050
        delay_init();                     //Ñóê±oˉêy3õê¼»ˉ
        NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);// éèÖÃÖD¶ÏóÅÏè¼¶·Ö×é2
//        TIM3_Int_Init(19,7199);//10KhzμļÆêyÆμÂ꣬¼Æêyμ½20Îa2ms  
        while(1)
        {
        //        if(biaozhi==1)
        //        {
                for(i=0;i<1000;++i)
                  for(j=0;j<100;++j)
                {
                        ant[j]=b+j;
                        printf("@");
                }
                for(i=0;i<1000;++i)
                  for(j=0;j<100;++j)
                {
                        sprintf(ag,"%f",ant[j]);
                        printf(ag);       
                }
       
                //sprintf(yg,"%d",aacy);
        //        sprintf(zg,"%d",aacz);
        //        printf("a");
               
                //printf("@");
        //        printf(yg);
        //        printf("@");
        ////        printf(zg);
                //printf("@b");
        //        sprintf(yc,"%d",gyroy);//y&#189;&#199;&#203;ù&#182;è
        //        printf(yc);//·¢&#203;í&#212;-ê&#188;êy&#190;Y
        //  printf(" ");
                //gyroyka=kalman_filter(gyroy,0.000001,0.0001,52,1,cishu);
        //        if(cishu==1)
        //        {        cishu=0;}
        //        sprintf(yyc,"%lf",gyroyka);//y&#189;&#199;&#203;ù&#182;è
        //        printf(yyc);//&#191;¨&#182;&#251;&#194;ü&#194;&#203;2¨oó
        //        printf(" ");
                /*′&#248;í¨&#194;&#203;2¨*/
                //daitongyjiao=Third_IIR_Filter(0,gyroyka);
        //        daitongyjiao1=(short)(daitongyjiao*100);
        //        sprintf(daitong,"%d",daitongyjiao1);//y&#189;&#199;&#203;ù&#182;è
        //        printf(daitong);//′&#248;í¨&#194;&#203;2¨oó
                //printf(zc);
        //        printf("@");
          printf("\r\n");       
                biaozhi=0;
                }

        //}        
}










这里运行不了程序,问题在于二维数据,当我定义二维数组大小是ant[2][2]时候,就能运行,但是当定义这个数组大的时候就不行了。为什么,急急急急急

正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

2

主题

3

帖子

0

精华

新手上路

积分
24
金钱
24
注册时间
2017-11-28
在线时间
0 小时
 楼主| 发表于 2017-11-29 21:42:47 | 显示全部楼层
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-6-10 17:27

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表