在芯片K60上用IAR写了个显示程序,用仿真器连接K60调试正常,拔下仿真器无法正常工作

在芯片K60上用IAR写了个显示程序,用仿真器连接K60调试正常,拔下仿真器无法正常工作,任务起来了,但是串口打印显示任务进了几次就不进去了,求大神解答
{COMPONENT_TASK, componentTask, 5000, 7, "hmiComponent", MQX_USER_TASK, 0, 0 },//CL 文件解析显示程序
_task_create(0,COMPONENT_TASK,0);//任务是这么起的

VOID componentTask(UINT32 initial_data)
{
INT32 i;
INT32 ret;

INT32 run_count;

    mqxprintf("componentTask step1\n");

guiRegistDisplayString("初始化错误参数名最大小步长度单位当前值编辑内码参数修改宏称整数显示使能电系交浮");

    mqxprintf("componentTask step2\n");
//加载装置配置文件
ret = loadDeviceCfgFile(DEVICE_CONFIG_FILE_NAME);
if(ret < 0)//加载失败
{
    mqxprintf("加载device.cfg失败,ret = %d\n",ret);
    //return;
}

    mqxprintf("componentTask step3\n");
//加载装置定值文件
ret = loadDeviceSettings(DEVICE_SETTINGS_BIN_FILE_NAME,DEVICE_TYPE_10);
if(ret < 0)//读取失败
{
    mqxprintf("加载settings.bin失败,ret = %d\n",ret);
}

component_reload_flag = TRUE;
    mqxprintf("componentTask step4\n");

run_count = 0;
while(1)
{
    mqxprintf("*");
    run_count++;

    g_local_sys_usec += 100000;
    if(g_local_sys_usec >= 1000000)
    {
        g_local_sys_sec++;  
        g_local_sys_usec = 0;
    }

    if(component_reload_flag == TRUE)
    {
        component_reload_flag = FALSE;
        //停运组件
        for(i = 0;i < component_instance_vector.size();i++)
        {
            if(component_instance_vector[i]->stop != NULL)
            {
                component_instance_vector[i]->stop(run_count,NULL);
            }
        }

        //加载临时定值
        ret = loadDeviceSettings(DEVICE_SETTINGS_TMP_FILE_NAME,0);
  mqxprintf("loadDeviceSettings done!\n");
        if(ret < 0)
        {
            mqxprintf("加载settings.tmp失败,ret = %d\n",ret);
        }
        else
        {
            remove(DEVICE_SETTINGS_TMP_FILE_NAME);
        }

        //更新参数
        updateParameter();
  mqxprintf("updateParameter done!\n");
        //自动填充
        for(i = 0;i < component_instance_vector.size();i++)
        {
            if(component_instance_vector[i]->autoPadPara != NULL)
            {
                component_instance_vector[i]->autoPadPara(run_count,NULL);
            }
        }

        //更新包含宏的信号输出
        updateMarcoSignalout();
  mqxprintf("updateMarcoSignalout done!\n");
        //更新包含宏的参数
        updateMarcoParameter();
  mqxprintf("updateMarcoParameter done!\n");
        //按照显示掩码过滤表
        filterTableByShowMask();
  mqxprintf("filterTableByShowMask done!\n");
        //按照显示掩码过滤参数组
        filterParameterGroupByShowMask();
  mqxprintf("filterParameterGroupByShowMask done!\n");
        //保存定值
        ret = saveDeviceSettings(DEVICE_SETTINGS_BIN_FILE_NAME,DEVICE_TYPE_10);
  mqxprintf("saveDeviceSettings done!\n");
        if(ret < 0)//保存失败
        {
            mqxprintf("保存settings.bin失败,ret = %d\n",ret);
        }

        //更新汉字库
        guiUpdateHanZiDot12X12();
  mqxprintf("guiUpdateHanZiDot12X12 done!\n");
        //step1
        for(i = 0;i < component_instance_vector.size();i++)
        {
            if(component_instance_vector[i]->initStep1 != NULL)
            {
                component_instance_vector[i]->initStep1(run_count,NULL);
            }
        }
  mqxprintf("componentTask step1 done!\n");
        //step2
        for(i = 0;i < component_instance_vector.size();i++)
        {
            if(component_instance_vector[i]->initStep2 != NULL)
            {
                component_instance_vector[i]->initStep2(run_count,NULL);
            }
        }
  mqxprintf("componentTask step2 done!\n");
    }
    //运行组件
    for(i = 0;i < component_instance_vector.size();i++)
    {
        if(component_instance_vector[i]->run != NULL)
        {
            component_instance_vector[i]->run(run_count,NULL);
        }
    }
mqxprintf("componentTask run done!\n");
TASK_DELAY_MS(100);
}

}

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!