打印
[ZLG-ARM]

ucos Data Abort 怪问题

[复制链接]
1954|1
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
fujianhui|  楼主 | 2007-10-8 10:44 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
最近碰到个怪问题..在UCOS中.我的一个电机控制任务.如果用定时器来产生 输出脉冲.运行10多分钟就会产生 data abort interrupt.. 如果用OSTimeDly(1);延时产生,,就不会,,定时器 时发一个消息.. 电机控制任务是等待消息,,..怪,, 下面是部分程序:
void    MotorCtrolTask(void *pdata)
{    //INT8U    Error;
    INT8U    i=0;
    pdata =  pdata;         
    MotorInit();
    while(1)
    {        
            //OSSemPend(MotorRunSem,0,&Error);               /*µÈ´ýmotor out enable ÐźÅÁ¿ */
            OSTimeDly(1);
            if(MotorStatus == STOP)
            {
                MotorStatus = INCREASE;
            }    
            else
            {    MOTORCLK_1;    
                for(i=0;i<30;i++);
                switch(MotorStatus)
                {    case INCREASE:    MotorIncreaseRate++;
                                    if(MotorIncreaseRate>MOTORRATE)
                                    {    MotorIncreaseRate = 0;
                                        MotorStartStep++;
                                        if(MotorStartStep>=STARTSTEP)
                                        {    MotorStatus = RUN;
                                            MotorStartStep = STARTSTEP; 
                                        }
                                        MotorStartStopControl(MotorStartStep);
                                    }
                                    break;
                    case DECREASE:    MotorIncreaseRate++;
                                    if(MotorIncreaseRate>MOTORRATE)
                                    {    MotorIncreaseRate = 0;
                                        if(MotorStartStep>0)
                                        {    MotorStartStep--;
                                            MotorStartStopControl(MotorStartStep);
                                        }
                                        else
                                        {    MotorStatus = STOP;
                                            MOTORRESET_0;
                                            MOTORRESET_1;
                                            MOTORCLK_0;
                                        }
                                    }
                                    break;
                    default:        break;
                }
                OSTimeDly(1);
                MOTORCLK_0;
            }
    }
}    
//---------------------------------------------------------------

void Timer1_Exception(void)
{    T1IR = 0x01;
    VICVectAddr = 0;            //interrupt close Í¨ÖªÖжϿØÖÆÆ÷ÖжϽáÊø
    OSSemPost(MotorRunSem);
}

相关帖子

沙发
fujianhui|  楼主 | 2007-10-8 12:00 | 只看该作者

找出原因了

IRQ_STACK_LEGTH         EQU         9*15            

修改了这个就可以了,,我想应该是 椎栈设的太小了, 原来的是 9*8的..按ZLG给我们的模板来的,

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

24

主题

92

帖子

2

粉丝